updated UI, added icons

This commit is contained in:
Vokhmin Alexey V 2015-02-07 03:37:52 +03:00
parent cc1b70ffac
commit 14c8f80089
11 changed files with 125 additions and 57 deletions

View File

@ -22,7 +22,29 @@ module ApplicationHelper
(controller_name.include?('build_lists') ? controller_name : params[:controller]).include?(base.to_s) ? 'active' : nil
end
def title_object object
# Public: Get icon css class.
#
# base - the tab (Symbol).
#
# Returns String css class.
def top_menu_icon(base)
case base
when :platforms
'fa-linux'
when :projects
'fa-cube'
when :build_lists
'fa-cogs'
when :groups
'fa-users'
when :advisories
'fa-newspaper-o'
when :statistics
'fa-area-chart'
end
end
def title_object(object)
return object.advisory_id if object.class == Advisory
name = object.class == Group ? object.uname : object.name
object_name = t "activerecord.models.#{object.class.name.downcase}"

View File

@ -13,23 +13,36 @@ nav.navbar.navbar-inverse.top_menu role = "navigation"
ul.nav.navbar-nav
- (collection = t 'top_menu').each do |base, title|
- if can? :index, base.to_s.classify.constantize
li[ class = top_menu_class(base) ]= link_to title, send("#{base}_path")
li class=top_menu_class(base)
a href=send("#{base}_path")
i.fa.hidden-sm class=top_menu_icon(base)
i.fa.visible-sm-inline-block.fa-2x class=top_menu_icon(base)
span.hidden-sm
=< title
- if current_user.try(:admin?)
li[ class = top_menu_class('admin') ]= link_to t('admins_menu_header'), admin_users_path
= form_tag search_index_path, method: 'get', class: 'navbar-form navbar-left',
role: 'search', style: "width:30%" do
.form-group style = 'display: inline'
.input-group style = 'width: 100%'
= text_field_tag 'query', @query, placeholder: t('layout.search.header'), class: 'form-control'
li class=top_menu_class('admin')
a href=admin_users_path
i.fa.fa-lock.hidden-sm
i.fa.fa-lock.visible-sm-inline-block.fa-2x
span.hidden-sm
=< t('admins_menu_header')
li
= form_tag search_index_path, method: 'get', class: 'navbar-form navbar-left',
role: 'search' do
.form-group
= text_field_tag 'query', @query, placeholder: t('layout.search.header'), class: 'form-control'
ul.nav.navbar-nav.navbar-right
- if current_user
li
.avatar= image_tag avatar_url(current_user), alt: 'avatar', class: 'img-responsive'
li.hidden-xs
.avatar
= image_tag avatar_url(current_user), alt: 'avatar', class: 'img-responsive'
li.dropdown
a.dropdown[ data-toggle = 'dropdown' href = '#' id = 'userMenuLabel'
aria-haspopup = 'true' aria-expanded = 'false' ]
= current_user.uname
b.caret
span.visible-xs-inline-block.visible-lg-inline-block>
= current_user.uname
i.fa.fa-cog.hidden-sm
i.fa.fa-cog.visible-sm-inline-block.fa-2x
ul.dropdown-menu role = 'menu' aria-labelledby = 'userMenuLabel'
li= link_to current_user.uname, current_user
li= link_to t('layout.settings.label'), profile_settings_path

View File

@ -1,5 +0,0 @@
%p.navbar-text.navbar-left.current_branch #{t('layout.projects.current_branch')}:
%form.navbar-form.navbar-left
.form-group
= select_tag :branch, branch_selector_options(project), id: 'branch_selector', class: 'form-control'
%form{action: '', method: :get, id: 'branch_changer', 'data-action' => "#{controller_name}"}

View File

@ -0,0 +1,7 @@
p.navbar-text.navbar-left.current_branch
= t('layout.projects.current_branch')
| :
form.navbar-form.navbar-left
.form-group
= select_tag :branch, branch_selector_options(project), id: 'branch_selector', class: 'form-control'
form action='' method='get' id='branch_changer' data-action=controller_name

View File

@ -69,10 +69,18 @@ div[ role = 'navigation' ng-controller = 'ProjectRepoBlockController' ng-cloak =
.row
ul.nav.nav-tabs role = 'tablist'
li class = ('active' if act == :show && contr == :trees )
= link_to t('project_menu.files'), tree_path(project, treeish)
a href=tree_path(project, treeish)
i.fa.fa-files-o>
= t('project_menu.files')
li class = ('active' if act == :index && contr == :commits )
= link_to t('project_menu.commits'), commits_path(project, treeish)
a href=commits_path(project, treeish)
i.fa.fa-history>
= t('project_menu.commits')
li class = ('active' if act == :branches && contr == :trees )
= link_to t('project_menu.branches', count: '{{singleton.project.branches_count}}'), branch_path(project, branch)
a href=branch_path(project, branch)
i.fa.fa-code-fork>
= t('project_menu.branches', count: '{{singleton.project.branches_count}}')
li.tags class = ('active' if act == :tags && contr == :trees )
= link_to t('project_menu.tags', count: project.repo.tags.count), tags_path(project)
a href=tags_path(project)
i.fa.fa-tag>
= t('project_menu.tags', count: project.repo.tags.count)

View File

@ -28,23 +28,33 @@
= fa_icon 'code-fork'
=< @project.parent.name_with_owner
li class=('active' if act.in?([:show, :edit, :branches, :tags]) && contr.in?([:trees, :blobs]) || contr == :commits)
= link_to t('project_menu.code'), tree_path(@project, treeish)
a href=tree_path(@project, treeish)
i.fa.fa-files-o>
= t('project_menu.code')
- if @project.is_package and can?(:read, @project => BuildList)
li class=('active' if contr == :build_lists)
= link_to t('project_menu.builds'), project_build_lists_path(@project)
a href=project_build_lists_path(@project)
i.fa.fa-cogs>
= t('project_menu.builds')
- if @project.has_issues
li class=('active' if contr == :issues && act == :index)
= link_to t('project_menu.tracker', count: @opened_issues_count), project_issues_path(@project)
a href=project_issues_path(@project)
i.fa.fa-exclamation-circle>
= t('project_menu.tracker', count: @opened_issues_count)
li class=('active' if contr == :issues && act == :pull_requests)
= link_to t('project_menu.pull_requests', count: @opened_pull_requests_count), project_pull_requests_path(@project)
a href=project_pull_requests_path(@project)
i.fa.fa-tasks>
= t('project_menu.pull_requests', count: @opened_pull_requests_count)
- if @project.has_wiki
li class=('active' if contr == :wiki)
= link_to t('project_menu.wiki'), project_wiki_index_path(@project)
li
/ = link_to t('project_menu.readme'), '#' #pending
/ li
/ = link_to t('project_menu.readme'), '#' #pending
- if can? :update, @project
li class=('active' if act.in?(%i[edit update sections]) && contr == :projects)
= link_to t('project_menu.settings'), edit_project_path(@project)
a href=edit_project_path(@project)
i.fa.fa-cog>
= t('project_menu.settings')
/ /.navbar-collapse
/ /.container-fluid

View File

@ -74,6 +74,7 @@
= t('layout.processing')
.btn-group{ 'ng-hide' => 'isRequest' }
%button.btn.btn-primary{ type: 'button', 'ng-click' => 'refresh(true)' }
%i.fa.fa-search
= t('layout.search.header')
.btn-group
%button.btn.btn-primary{ type: 'button', 'ng-click' => 'clear()' }= t('reset')
@ -81,5 +82,6 @@
.btn-group
%button.btn.btn-primary{ id: 'filter_new_build', type: 'button',
onclick: "location.href='#{new_project_build_list_path(@project)}'" }
%i.fa.fa-plus
= t('layout.build_lists.new_header')
= hidden_field_tag :name_with_owner, @project.try(:name_with_owner)

View File

@ -50,9 +50,12 @@
f: f
= hidden_field_tag :from_build_list_id, params[:build_list_id] if params[:build_list_id].present?
= f.submit t('layout.projects.build_button'),
%hr
= button_tag type: :submit,
data: {'disable-with' => t('layout.processing')},
class: 'btn btn-primary offset10'
class: 'btn btn-primary' do
%i.fa.fa-check
= t('layout.projects.build_button')
- content_for :additional_scripts do
= render 'projects/build_lists/new_build/init_service.js.erb'

View File

@ -1,27 +0,0 @@
= hidden_field_tag :possible_forks_path, possible_forks_project_path(@project)
- if can? :write, @project
.pull-right.roffset5
=link_to t("projects.pull_requests.show.pull"), new_project_pull_request_path(@project, treeish: @treeish),
id: 'send_pull_request', class: 'btn btn-primary'
- if can? :fork, @project
.pull-right#fork-and-edit.roffset5
= link_to t('layout.projects.fork_and_edit'), '#', class: 'btn btn-primary',
'data-toggle' => 'modal', 'data-target' => '#forkModal'
#forkModal.modal.fade{ tabindex: '-1', role: 'dialog', 'aria-labelledby' => 'forkModalLabel', 'aria-hidden' => 'true' }
.modal-dialog
.modal-content
.modal-header
%button.close{ type: 'button', 'data-dismiss' => 'modal' }
%span{ 'aria-hidden' => 'true' } &times;
%span.sr-only Close
%h4.modal-title#myModalLabel= t 'layout.projects.fork_modal_header'
= hidden_field_tag :possible_forks, possible_forks_project_path(@project)
%p.offset10= text_field_tag 'fork_name', @project.name, id: 'fork_name', class: 'form-control'
.modal-body= render 'forks', owner: current_user, name: @project.name
- if @project.is_package && can?(:create, @project.build_lists.new)
.pull-right.roffset5
- params = { build_list: { project_version: @treeish}}
= link_to t('layout.projects.new_build_list'), new_project_build_list_path(@project, params), class: 'btn btn-primary'

View File

@ -0,0 +1,34 @@
= hidden_field_tag :possible_forks_path, possible_forks_project_path(@project)
- if can? :write, @project
.pull-right.roffset5
a.btn.btn-primary href=new_project_pull_request_path(@project, treeish: @treeish)
i.fa.fa-upload>
= t('projects.pull_requests.show.pull')
- if can? :fork, @project
.pull-right#fork-and-edit.roffset5
a.btn.btn-primary href='#' data-toggle='modal' data-target='#forkModal'
i.fa.fa-code-fork>
= t('layout.projects.fork_and_edit')
#forkModal.modal.fade tabindex='-1' role='dialog' aria-labelledby='forkModalLabel' aria-hidden=true
.modal-dialog
.modal-content
.modal-header
button.close type="button" data-dismiss="modal"
span aria-hidden=true &times;
span.sr-only Close
h4.modal-title#myModalLabel
= t('layout.projects.fork_modal_header')
= hidden_field_tag :possible_forks, possible_forks_project_path(@project)
p.offset10
= text_field_tag 'fork_name', @project.name, id: 'fork_name', class: 'form-control'
.modal-body
= render 'forks', owner: current_user, name: @project.name
- if @project.is_package && can?(:create, @project.build_lists.new)
.pull-right.roffset5
- params = { build_list: { project_version: @treeish}}
a.btn.btn-primary href=new_project_build_list_path(@project, params)
i.fa.fa-plus>
= t('layout.projects.new_build_list')

View File

@ -37,6 +37,7 @@ h4
.col-md-4
button[ class='btn btn-primary' type='button'
ng-click="#{ctrl_as}add#{func_name}()" ]
i.fa.fa-plus>
= t('layout.add')
table.table.offset5