From 14c8f800890a43c2fd9e918d1c37d7fa426bff3b Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Sat, 7 Feb 2015 03:37:52 +0300 Subject: [PATCH] updated UI, added icons --- app/helpers/application_helper.rb | 24 ++++++++++++- app/views/layouts/menu/_new_top.html.slim | 35 +++++++++++++------ .../projects/base/_branch_select.html.haml | 5 --- .../projects/base/_branch_select.html.slim | 7 ++++ app/views/projects/base/_repo_block.html.slim | 16 ++++++--- app/views/projects/base/_submenu.html.slim | 24 +++++++++---- .../projects/build_lists/_filter.html.haml | 2 ++ .../build_lists/new_build/_new_form.html.haml | 7 ++-- app/views/projects/git/base/_fork.html.haml | 27 -------------- app/views/projects/git/base/_fork.html.slim | 34 ++++++++++++++++++ app/views/shared/_autocomplete_form.html.slim | 1 + 11 files changed, 125 insertions(+), 57 deletions(-) delete mode 100644 app/views/projects/base/_branch_select.html.haml create mode 100644 app/views/projects/base/_branch_select.html.slim delete mode 100644 app/views/projects/git/base/_fork.html.haml create mode 100644 app/views/projects/git/base/_fork.html.slim diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ebbc374b7..be6642739 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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}" diff --git a/app/views/layouts/menu/_new_top.html.slim b/app/views/layouts/menu/_new_top.html.slim index 2868de83b..9ed905655 100644 --- a/app/views/layouts/menu/_new_top.html.slim +++ b/app/views/layouts/menu/_new_top.html.slim @@ -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 diff --git a/app/views/projects/base/_branch_select.html.haml b/app/views/projects/base/_branch_select.html.haml deleted file mode 100644 index 18e989550..000000000 --- a/app/views/projects/base/_branch_select.html.haml +++ /dev/null @@ -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}"} diff --git a/app/views/projects/base/_branch_select.html.slim b/app/views/projects/base/_branch_select.html.slim new file mode 100644 index 000000000..78e0857d9 --- /dev/null +++ b/app/views/projects/base/_branch_select.html.slim @@ -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 diff --git a/app/views/projects/base/_repo_block.html.slim b/app/views/projects/base/_repo_block.html.slim index e8387e73a..8b9bf7b5a 100644 --- a/app/views/projects/base/_repo_block.html.slim +++ b/app/views/projects/base/_repo_block.html.slim @@ -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) diff --git a/app/views/projects/base/_submenu.html.slim b/app/views/projects/base/_submenu.html.slim index d13399a8b..dfa97fca6 100644 --- a/app/views/projects/base/_submenu.html.slim +++ b/app/views/projects/base/_submenu.html.slim @@ -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 diff --git a/app/views/projects/build_lists/_filter.html.haml b/app/views/projects/build_lists/_filter.html.haml index 32785070c..93f8eb9a2 100644 --- a/app/views/projects/build_lists/_filter.html.haml +++ b/app/views/projects/build_lists/_filter.html.haml @@ -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) diff --git a/app/views/projects/build_lists/new_build/_new_form.html.haml b/app/views/projects/build_lists/new_build/_new_form.html.haml index 2173e7aa5..f337643b3 100644 --- a/app/views/projects/build_lists/new_build/_new_form.html.haml +++ b/app/views/projects/build_lists/new_build/_new_form.html.haml @@ -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' diff --git a/app/views/projects/git/base/_fork.html.haml b/app/views/projects/git/base/_fork.html.haml deleted file mode 100644 index 4f533a0f1..000000000 --- a/app/views/projects/git/base/_fork.html.haml +++ /dev/null @@ -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' } × - %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' diff --git a/app/views/projects/git/base/_fork.html.slim b/app/views/projects/git/base/_fork.html.slim new file mode 100644 index 000000000..797a970f9 --- /dev/null +++ b/app/views/projects/git/base/_fork.html.slim @@ -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 × + 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') diff --git a/app/views/shared/_autocomplete_form.html.slim b/app/views/shared/_autocomplete_form.html.slim index 12fb97458..5f9927dd3 100644 --- a/app/views/shared/_autocomplete_form.html.slim +++ b/app/views/shared/_autocomplete_form.html.slim @@ -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