From 406552d3390c661473dba049b8c0978b91c63995 Mon Sep 17 00:00:00 2001 From: Luke Howell Date: Wed, 19 Oct 2016 11:02:20 -0500 Subject: [PATCH 1/2] First steps in moving settings cog to navigation tab - Added `Settings` tab to main navigiaton bar - Added subnav to Settings page - Added top level links for subnav - Added first page for subnav sections - Added subnav to pages linked under settings Correcting section containers Adding groups to members section Moving sections around Trying to move sections around but implementation Adding imports for javascript necessities Removing project settings gear --- app/assets/javascripts/dispatcher.js.es6 | 13 ++-- .../projects/deploy_keys_controller.rb | 2 + .../projects/group_links_controller.rb | 5 +- app/controllers/projects/hooks_controller.rb | 3 + .../projects/pipelines_settings_controller.rb | 9 +-- .../projects/project_members_controller.rb | 7 ++- .../projects/runners_controller.rb | 12 ++++ .../projects/services_controller.rb | 2 +- .../projects/triggers_controller.rb | 3 +- .../projects/variables_controller.rb | 2 +- app/controllers/projects_controller.rb | 4 ++ app/views/layouts/nav/_project.html.haml | 23 ++----- .../projects/deploy_keys/index.html.haml | 5 ++ app/views/projects/deploy_keys/new.html.haml | 2 + app/views/projects/edit.html.haml | 3 + .../{index.html.haml => _index.html.haml} | 1 - app/views/projects/hooks/index.html.haml | 7 +++ .../{show.html.haml => _show.html.haml} | 6 +- .../projects/project_members/index.html.haml | 54 +++++++++------- .../_create_protected_branch.html.haml | 2 +- .../{index.html.haml => _index.html.haml} | 7 +-- .../_protected_branch.html.haml | 2 +- app/views/projects/runners/edit.html.haml | 1 + app/views/projects/runners/index.html.haml | 62 ++++++++++++------- app/views/projects/runners/show.html.haml | 1 + .../{index.html.haml => _index.html.haml} | 2 - app/views/projects/settings/_nav.html.haml | 24 +++++++ .../{index.html.haml => _index.html.haml} | 6 +- .../{index.html.haml => _index.html.haml} | 6 +- ...e-23007-replace-settings-gear-with-tab.yml | 4 ++ 30 files changed, 175 insertions(+), 105 deletions(-) rename app/views/projects/group_links/{index.html.haml => _index.html.haml} (99%) rename app/views/projects/pipelines_settings/{show.html.haml => _show.html.haml} (97%) rename app/views/projects/protected_branches/{index.html.haml => _index.html.haml} (86%) rename app/views/projects/services/{index.html.haml => _index.html.haml} (97%) create mode 100644 app/views/projects/settings/_nav.html.haml rename app/views/projects/triggers/{index.html.haml => _index.html.haml} (96%) rename app/views/projects/variables/{index.html.haml => _index.html.haml} (71%) create mode 100644 changelogs/unreleased/lukehowell-gitlab-ce-23007-replace-settings-gear-with-tab.yml diff --git a/app/assets/javascripts/dispatcher.js.es6 b/app/assets/javascripts/dispatcher.js.es6 index c2d4670b7e9b..5e772bdee2cb 100644 --- a/app/assets/javascripts/dispatcher.js.es6 +++ b/app/assets/javascripts/dispatcher.js.es6 @@ -155,6 +155,11 @@ new gl.MemberExpirationDate(); new gl.Members(); new UsersSelect(); + new GroupsSelect(); + break; + case 'projects:deploy_keys:index': + new gl.ProtectedBranchCreate(); + new gl.ProtectedBranchEditList(); break; case 'groups:new': case 'groups:edit': @@ -197,10 +202,6 @@ case 'projects:artifacts:browse': new BuildArtifacts(); break; - case 'projects:group_links:index': - new gl.MemberExpirationDate(); - new GroupsSelect(); - break; case 'search:show': new Search(); break; @@ -208,6 +209,9 @@ new gl.ProtectedBranchCreate(); new gl.ProtectedBranchEditList(); break; + case 'projects:cycle_analytics:show': + new gl.CycleAnalytics(); + break; } switch (path.first()) { case 'admin': @@ -281,7 +285,6 @@ case 'builds': case 'hooks': case 'services': - case 'protected_branches': shortcut_handler = new ShortcutsNavigation(); } } diff --git a/app/controllers/projects/deploy_keys_controller.rb b/app/controllers/projects/deploy_keys_controller.rb index 529e0aa2d33e..db2c8ae6b533 100644 --- a/app/controllers/projects/deploy_keys_controller.rb +++ b/app/controllers/projects/deploy_keys_controller.rb @@ -8,6 +8,8 @@ class Projects::DeployKeysController < Projects::ApplicationController def index @key = DeployKey.new + @protected_branch = @project.protected_branches.new + @protected_branches = @project.protected_branches.order(:name).page(params[:page]) set_index_vars end diff --git a/app/controllers/projects/group_links_controller.rb b/app/controllers/projects/group_links_controller.rb index 9eaf26a0dbf9..7eef31fe86cf 100644 --- a/app/controllers/projects/group_links_controller.rb +++ b/app/controllers/projects/group_links_controller.rb @@ -4,10 +4,7 @@ class Projects::GroupLinksController < Projects::ApplicationController before_action :authorize_admin_project_member!, only: [:update] def index - @group_links = project.project_group_links.all - - @skip_groups = @group_links.pluck(:group_id) - @skip_groups << project.namespace_id unless project.personal? + redirect_to namespace_project_project_members_path(@project.namespace, @project) end def create diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index 0ae8ff98009a..76e74e796595 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -9,6 +9,9 @@ class Projects::HooksController < Projects::ApplicationController def index @hooks = @project.hooks @hook = ProjectHook.new + + @project.build_missing_services + @services = @project.services.visible.reload end def create diff --git a/app/controllers/projects/pipelines_settings_controller.rb b/app/controllers/projects/pipelines_settings_controller.rb index 53ce23221edf..c7eb459e3d07 100644 --- a/app/controllers/projects/pipelines_settings_controller.rb +++ b/app/controllers/projects/pipelines_settings_controller.rb @@ -2,14 +2,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController before_action :authorize_admin_pipeline! def show - @ref = params[:ref] || @project.default_branch || 'master' - - @badges = [Gitlab::Badge::Build::Status, - Gitlab::Badge::Coverage::Report] - - @badges.map! do |badge| - badge.new(@project, @ref).metadata - end + redirect_to namespace_project_runners_path(@project.namespace, @project) end def update diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb index 699a56ae2f87..fb5e33631241 100644 --- a/app/controllers/projects/project_members_controller.rb +++ b/app/controllers/projects/project_members_controller.rb @@ -5,11 +5,14 @@ class Projects::ProjectMembersController < Projects::ApplicationController before_action :authorize_admin_project_member!, except: [:index, :leave, :request_access] def index - @group_links = @project.project_group_links - @project_members = @project.project_members @project_members = @project_members.non_invite unless can?(current_user, :admin_project, @project) + @group_links = project.project_group_links.all + + @skip_groups = @group_links.pluck(:group_id) + @skip_groups << project.group.try(:id) + if params[:search].present? users = @project.users.search(params[:search]).to_a @project_members = @project_members.where(user_id: users) diff --git a/app/controllers/projects/runners_controller.rb b/app/controllers/projects/runners_controller.rb index 53c36635efe1..344efcd7871d 100644 --- a/app/controllers/projects/runners_controller.rb +++ b/app/controllers/projects/runners_controller.rb @@ -10,6 +10,18 @@ def index assignable_for(project).ordered.page(params[:page]).per(20) @shared_runners = Ci::Runner.shared.active @shared_runners_count = @shared_runners.count(:all) + + @variable = Ci::Variable.new + + @triggers = project.triggers + @trigger = Ci::Trigger.new + + @ref = params[:ref] || @project.default_branch || 'master' + @badges = [Gitlab::Badge::Build::Status, + Gitlab::Badge::Coverage::Report] + @badges.map! do |badge| + badge.new(@project, @ref).metadata + end end def edit diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index 30c2a5d99827..c6500ed409be 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -10,7 +10,7 @@ class Projects::ServicesController < Projects::ApplicationController layout "project_settings" def index - @services = @project.find_or_initialize_services + redirect_to namespace_project_hooks_path(@project.namespace, @project) end def edit diff --git a/app/controllers/projects/triggers_controller.rb b/app/controllers/projects/triggers_controller.rb index 92359745cec8..ae389f19784e 100644 --- a/app/controllers/projects/triggers_controller.rb +++ b/app/controllers/projects/triggers_controller.rb @@ -4,8 +4,7 @@ class Projects::TriggersController < Projects::ApplicationController layout 'project_settings' def index - @triggers = project.triggers - @trigger = Ci::Trigger.new + redirect_to namespace_project_runners_path(project.namespace, project) end def create diff --git a/app/controllers/projects/variables_controller.rb b/app/controllers/projects/variables_controller.rb index 6f0687293907..ed1f7b0e4be7 100644 --- a/app/controllers/projects/variables_controller.rb +++ b/app/controllers/projects/variables_controller.rb @@ -4,7 +4,7 @@ class Projects::VariablesController < Projects::ApplicationController layout 'project_settings' def index - @variable = Ci::Variable.new + redirect_to namespace_project_runners_path(project.namespace, project) end def show diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a8a18b4fa167..05696f8b1691 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -26,6 +26,10 @@ def edit render 'edit' end + def integrations + render 'settings/integrations' + end + def create @project = ::Projects::CreateService.new(current_user, project_params).execute diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index cc24e51b268b..53be002a4fec 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -1,20 +1,3 @@ -- if current_user - .controls - .dropdown.project-settings-dropdown - %a.dropdown-new.btn.btn-default#project-settings-button{href: '#', 'data-toggle' => 'dropdown'} - = icon('cog') - = icon('caret-down') - %ul.dropdown-menu.dropdown-menu-align-right - - can_edit = can?(current_user, :admin_project, @project) - - = render 'layouts/nav/project_settings', can_edit: can_edit - - - if can_edit - %li.divider - %li - = link_to edit_project_path(@project) do - Edit Project - .scrolling-tabs-container{ class: nav_control_class } .fade-left = icon('angle-left') @@ -82,6 +65,12 @@ %span Snippets + - if project_nav_tab? :settings + = nav_link(path: ['projects#edit', 'project_members#index', 'hooks#index', 'deploy_keys#index', 'runners#index']) do + = link_to edit_project_path(@project), title: 'Settings', class: 'shortcuts-settings' do + %span + Settings + -# Global shortcut to network page for compatibility - if project_nav_tab? :network %li.hidden diff --git a/app/views/projects/deploy_keys/index.html.haml b/app/views/projects/deploy_keys/index.html.haml index 04fbb37d93fa..5c82c114cc8a 100644 --- a/app/views/projects/deploy_keys/index.html.haml +++ b/app/views/projects/deploy_keys/index.html.haml @@ -1,4 +1,5 @@ - page_title "Deploy Keys" += render "projects/settings/nav" .row.prepend-top-default .col-lg-3.profile-settings-sidebar @@ -34,3 +35,7 @@ Public deploy keys available to any project (#{@available_public_keys.size}) %ul.well-list = render @available_public_keys + +%hr + += render "projects/protected_branches/index" diff --git a/app/views/projects/deploy_keys/new.html.haml b/app/views/projects/deploy_keys/new.html.haml index 01fab3008a70..675b5b7cc7f2 100644 --- a/app/views/projects/deploy_keys/new.html.haml +++ b/app/views/projects/deploy_keys/new.html.haml @@ -1,4 +1,6 @@ - page_title "New Deploy Key" += render "projects/settings/nav" + %h3.page-title New Deploy Key %hr diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 3a5af2723c60..9f04b4debe92 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -1,3 +1,6 @@ +- page_title "Settings" += render "projects/settings/nav" + .project-edit-container .row.prepend-top-default .col-lg-3.profile-settings-sidebar diff --git a/app/views/projects/group_links/index.html.haml b/app/views/projects/group_links/_index.html.haml similarity index 99% rename from app/views/projects/group_links/index.html.haml rename to app/views/projects/group_links/_index.html.haml index 1b0dbbb8111a..9e0491d4db77 100644 --- a/app/views/projects/group_links/index.html.haml +++ b/app/views/projects/group_links/_index.html.haml @@ -1,4 +1,3 @@ -- page_title "Groups" .row.prepend-top-default .col-lg-3.settings-sidebar %h4.prepend-top-0 diff --git a/app/views/projects/hooks/index.html.haml b/app/views/projects/hooks/index.html.haml index 8faad351463a..5f6747f15fb2 100644 --- a/app/views/projects/hooks/index.html.haml +++ b/app/views/projects/hooks/index.html.haml @@ -1 +1,8 @@ +- page_title "Webhooks" += render "projects/settings/nav" + = render 'shared/web_hooks/form', hook: @hook, hooks: @hooks, url_components: [@project.namespace.becomes(Namespace), @project] + +%hr + += render "projects/services/index" diff --git a/app/views/projects/pipelines_settings/show.html.haml b/app/views/projects/pipelines_settings/_show.html.haml similarity index 97% rename from app/views/projects/pipelines_settings/show.html.haml rename to app/views/projects/pipelines_settings/_show.html.haml index 96221a205024..0ccb2b29b20b 100644 --- a/app/views/projects/pipelines_settings/show.html.haml +++ b/app/views/projects/pipelines_settings/_show.html.haml @@ -1,9 +1,7 @@ -- page_title "CI/CD Pipelines" - .row.prepend-top-default .col-lg-3.profile-settings-sidebar %h4.prepend-top-0 - = page_title + CI/CD Pipelines .col-lg-9 = form_for @project, url: namespace_project_pipelines_settings_path(@project.namespace.becomes(Namespace), @project) do |f| %fieldset.builds-feature @@ -92,4 +90,4 @@ %hr .row.prepend-top-default - = render partial: 'badge', collection: @badges + = render partial: 'projects/pipelines_settings/badge', collection: @badges diff --git a/app/views/projects/project_members/index.html.haml b/app/views/projects/project_members/index.html.haml index bdeb704b6daa..5115ddfa7140 100644 --- a/app/views/projects/project_members/index.html.haml +++ b/app/views/projects/project_members/index.html.haml @@ -1,28 +1,36 @@ - page_title "Members" += render "projects/settings/nav" -.project-members-page.prepend-top-default - %h4.project-members-title.clearfix - Members - = link_to "Import", import_namespace_project_project_members_path(@project.namespace, @project), class: "btn btn-default pull-right hidden-xs", title: "Import members from another project" - - if can?(current_user, :admin_project_member, @project) - .project-members-new.append-bottom-default - %p.clearfix - Add new user to - %strong= @project.name - = render "new_project_member" +.project-members-page + .row.prepend-top-default + .col-lg-3.project-members-sidebar + %h4.prepend-top-0 + Members + .col-lg-9 + = link_to "Import", import_namespace_project_project_members_path(@project.namespace, @project), class: "btn btn-default pull-right hidden-xs", title: "Import members from another project" + - if can?(current_user, :admin_project_member, @project) + .project-members-new.append-bottom-default + %p.clearfix + Add new user to + %strong= @project.name + = render "new_project_member" - = render 'shared/members/requests', membership_source: @project, requesters: @requesters + = render 'shared/members/requests', membership_source: @project, requesters: @requesters - .append-bottom-default.clearfix - %h5.member.existing-title - Existing users and groups - = form_tag namespace_project_project_members_path(@project.namespace, @project), method: :get, class: 'form-inline member-search-form' do - .form-group - = search_field_tag :search, params[:search], { placeholder: 'Find existing members by name', class: 'form-control', spellcheck: false } - %button.member-search-btn{ type: "submit", "aria-label" => "Submit search" } - = icon("search") - - if @group_links.any? - = render 'groups', group_links: @group_links + .append-bottom-default.clearfix + %h5.member.existing-title + Existing users and groups + = form_tag namespace_project_project_members_path(@project.namespace, @project), method: :get, class: 'form-inline member-search-form' do + .form-group + = search_field_tag :search, params[:search], { placeholder: 'Find existing members by name', class: 'form-control', spellcheck: false } + %button.member-search-btn{ type: "submit", "aria-label" => "Submit search" } + = icon("search") + - if @group_links.any? + = render 'groups', group_links: @group_links - = render 'team', members: @project_members - = paginate @project_members, theme: "gitlab" + = render 'team', members: @project_members + = paginate @project_members, theme: "gitlab" + + %hr + + = render "projects/group_links/index" diff --git a/app/views/projects/protected_branches/_create_protected_branch.html.haml b/app/views/projects/protected_branches/_create_protected_branch.html.haml index e95a3b1b4c36..b8e885b4d9a7 100644 --- a/app/views/projects/protected_branches/_create_protected_branch.html.haml +++ b/app/views/projects/protected_branches/_create_protected_branch.html.haml @@ -10,7 +10,7 @@ = f.label :name, class: 'col-md-2 text-right' do Branch: .col-md-10 - = render partial: "dropdown", locals: { f: f } + = render partial: "projects/protected_branches/dropdown", locals: { f: f } .help-block = link_to 'Wildcards', help_page_path('user/project/protected_branches', anchor: 'wildcard-protected-branches') such as diff --git a/app/views/projects/protected_branches/index.html.haml b/app/views/projects/protected_branches/_index.html.haml similarity index 86% rename from app/views/projects/protected_branches/index.html.haml rename to app/views/projects/protected_branches/_index.html.haml index 42e9bdbd30eb..51527d213468 100644 --- a/app/views/projects/protected_branches/index.html.haml +++ b/app/views/projects/protected_branches/_index.html.haml @@ -1,11 +1,10 @@ -- page_title "Protected branches" - content_for :page_specific_javascripts do = page_specific_javascript_tag('protected_branches/protected_branches_bundle.js') .row.prepend-top-default.append-bottom-default .col-lg-3 %h4.prepend-top-0 - = page_title + Protected branches %p Keep stable branches secure and force developers to use merge requests. %p.prepend-top-20 By default, protected branches are designed to: @@ -17,6 +16,6 @@ %p.append-bottom-0 Read more about #{link_to "protected branches", help_page_path("user/project/protected_branches"), class: "underlined-link"} and #{link_to "project permissions", help_page_path("user/permissions"), class: "underlined-link"}. .col-lg-9 - if can? current_user, :admin_project, @project - = render 'create_protected_branch' + = render 'projects/protected_branches/create_protected_branch' - = render "branches_list" + = render "projects/protected_branches/branches_list" diff --git a/app/views/projects/protected_branches/_protected_branch.html.haml b/app/views/projects/protected_branches/_protected_branch.html.haml index 0193800dedfd..b2a6b8469a35 100644 --- a/app/views/projects/protected_branches/_protected_branch.html.haml +++ b/app/views/projects/protected_branches/_protected_branch.html.haml @@ -14,7 +14,7 @@ - else (branch was removed from repository) - = render partial: 'update_protected_branch', locals: { protected_branch: protected_branch } + = render partial: 'projects/protected_branches/update_protected_branch', locals: { protected_branch: protected_branch } - if can_admin_project %td diff --git a/app/views/projects/runners/edit.html.haml b/app/views/projects/runners/edit.html.haml index 957068886557..25ecd58f36f5 100644 --- a/app/views/projects/runners/edit.html.haml +++ b/app/views/projects/runners/edit.html.haml @@ -1,4 +1,5 @@ - page_title "Edit", "#{@runner.description} ##{@runner.id}", "Runners" += render "projects/settings/nav" %h4 Runner ##{@runner.id} diff --git a/app/views/projects/runners/index.html.haml b/app/views/projects/runners/index.html.haml index 92957470070c..9e9d3d8ea69d 100644 --- a/app/views/projects/runners/index.html.haml +++ b/app/views/projects/runners/index.html.haml @@ -1,27 +1,45 @@ - page_title "Runners" += render "projects/settings/nav" -.light.prepend-top-default - %p - A 'Runner' is a process which runs a build. - You can setup as many Runners as you need. - %br - Runners can be placed on separate users, servers, and even on your local machine. - - %p Each Runner can be in one of the following states: - %div - %ul - %li - %span.label.label-success active - \- Runner is active and can process any new builds - %li - %span.label.label-danger paused - \- Runner is paused and will not receive any new builds +.row.prepend-top-default.append-bottom-default + .col-lg-3 + %h4.prepend-top-0 + Runners + .col-lg-9 + .light.prepend-top-default + %p + A 'Runner' is a process which runs a build. + You can setup as many Runners as you need. + %br + Runners can be placed on separate users, servers, and even on your local machine. + + %p Each Runner can be in one of the following states: + %div + %ul + %li + %span.label.label-success active + \- Runner is active and can process any new builds + %li + %span.label.label-danger paused + \- Runner is paused and will not receive any new builds + + %hr + + %p.lead To start serving your builds you can either add specific Runners to your project or use shared Runners + .row + .col-sm-6 + = render 'specific_runners' + .col-sm-6 + = render 'shared_runners' + +%hr + += render "projects/variables/index" + +%hr + += render "projects/triggers/index" %hr -%p.lead To start serving your builds you can either add specific Runners to your project or use shared Runners -.row - .col-sm-6 - = render 'specific_runners' - .col-sm-6 - = render 'shared_runners' += render "projects/pipelines_settings/show" diff --git a/app/views/projects/runners/show.html.haml b/app/views/projects/runners/show.html.haml index 61b99f35d746..ec4b8c695807 100644 --- a/app/views/projects/runners/show.html.haml +++ b/app/views/projects/runners/show.html.haml @@ -1,4 +1,5 @@ - page_title "#{@runner.description} ##{@runner.id}", "Runners" += render "projects/settings/nav" %h3.page-title Runner ##{@runner.id} diff --git a/app/views/projects/services/index.html.haml b/app/views/projects/services/_index.html.haml similarity index 97% rename from app/views/projects/services/index.html.haml rename to app/views/projects/services/_index.html.haml index 66fd3029dc9a..964133504e69 100644 --- a/app/views/projects/services/index.html.haml +++ b/app/views/projects/services/_index.html.haml @@ -1,5 +1,3 @@ -- page_title "Services" - .row.prepend-top-default.append-bottom-default .col-lg-3 %h4.prepend-top-0 diff --git a/app/views/projects/settings/_nav.html.haml b/app/views/projects/settings/_nav.html.haml new file mode 100644 index 000000000000..3af5234a938a --- /dev/null +++ b/app/views/projects/settings/_nav.html.haml @@ -0,0 +1,24 @@ += content_for :sub_nav do + .scrolling-tabs-container.sub-nav-scroll + = render 'shared/nav_scroll' + .nav-links.sub-nav.scrolling-tabs + %ul{ class: (container_class) } + = nav_link(path: 'projects#edit') do + = link_to edit_project_path(@project), title: 'General' do + General + + = nav_link(path: 'project_members#index') do + = link_to namespace_project_project_members_path(@project.namespace, @project), title: 'Members' do + Members + + = nav_link(path: 'hooks#index') do + = link_to namespace_project_hooks_path(@project.namespace, @project), title: 'Integrations' do + Integrations + + = nav_link(path: 'deploy_keys#index') do + = link_to namespace_project_deploy_keys_path(@project.namespace, @project), title: 'Repository' do + Repository + + = nav_link(path: 'runners#index') do + = link_to namespace_project_runners_path(@project.namespace, @project), title: 'Automation / CI' do + Automation / CI diff --git a/app/views/projects/triggers/index.html.haml b/app/views/projects/triggers/_index.html.haml similarity index 96% rename from app/views/projects/triggers/index.html.haml rename to app/views/projects/triggers/_index.html.haml index 6e5dd1b196dd..98b8714eaa96 100644 --- a/app/views/projects/triggers/index.html.haml +++ b/app/views/projects/triggers/_index.html.haml @@ -1,9 +1,7 @@ -- page_title "Triggers" - .row.prepend-top-default.append-bottom-default .col-lg-3 %h4.prepend-top-0 - = page_title + Triggers %p.prepend-top-20 Triggers can force a specific branch or tag to get rebuilt with an API call. %p.append-bottom-0 @@ -25,7 +23,7 @@ %th %strong Last used %th - = render partial: 'trigger', collection: @triggers, as: :trigger + = render partial: 'projects/triggers/trigger', collection: @triggers, as: :trigger - else %p.settings-message.text-center.append-bottom-default No triggers have been created yet. Add one using the button below. diff --git a/app/views/projects/variables/index.html.haml b/app/views/projects/variables/_index.html.haml similarity index 71% rename from app/views/projects/variables/index.html.haml rename to app/views/projects/variables/_index.html.haml index 09bb54600aff..06436ad22a7a 100644 --- a/app/views/projects/variables/index.html.haml +++ b/app/views/projects/variables/_index.html.haml @@ -2,11 +2,11 @@ .row.prepend-top-default.append-bottom-default .col-lg-3 - = render "content" + = render "projects/variables/content" .col-lg-9 %h5.prepend-top-0 Add a variable - = render "form", btn_text: "Add new variable" + = render "projects/variables/form", btn_text: "Add new variable" %hr %h5.prepend-top-0 Your variables (#{@project.variables.size}) @@ -14,4 +14,4 @@ %p.settings-message.text-center.append-bottom-0 No variables found, add one with the form above. - else - = render "table" + = render "projects/variables/table" diff --git a/changelogs/unreleased/lukehowell-gitlab-ce-23007-replace-settings-gear-with-tab.yml b/changelogs/unreleased/lukehowell-gitlab-ce-23007-replace-settings-gear-with-tab.yml new file mode 100644 index 000000000000..08f7b522bdf4 --- /dev/null +++ b/changelogs/unreleased/lukehowell-gitlab-ce-23007-replace-settings-gear-with-tab.yml @@ -0,0 +1,4 @@ +--- +title: Changed settings cog to settings tab +merge_request: 7771 +author: -- GitLab From fe38c28b87abd8d16d042606c04d10b0306069c0 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Sat, 26 Nov 2016 15:13:08 +0000 Subject: [PATCH 2/2] Fixed protected branches Fixed pipeline badges ref bug Fixed failing features --- .../projects/deploy_keys_controller.rb | 3 +++ app/controllers/projects/hooks_controller.rb | 3 +-- .../projects/pipelines_settings_controller.rb | 2 +- .../projects/protected_branches_controller.rb | 27 +++++++++---------- app/controllers/projects_controller.rb | 4 --- app/helpers/protected_branches_helper.rb | 13 +++++++++ features/project/active_tab.feature | 14 +++++----- features/steps/project/active_tab.rb | 24 ++++++++++------- features/steps/shared/project_tab.rb | 6 ++--- .../access_control_ce_spec.rb | 8 +++--- spec/features/protected_branches_spec.rb | 14 +++++----- 11 files changed, 66 insertions(+), 52 deletions(-) create mode 100644 app/helpers/protected_branches_helper.rb diff --git a/app/controllers/projects/deploy_keys_controller.rb b/app/controllers/projects/deploy_keys_controller.rb index db2c8ae6b533..755bd30d04be 100644 --- a/app/controllers/projects/deploy_keys_controller.rb +++ b/app/controllers/projects/deploy_keys_controller.rb @@ -1,4 +1,6 @@ class Projects::DeployKeysController < Projects::ApplicationController + include ProtectedBranchesHelper + respond_to :html # Authorize @@ -11,6 +13,7 @@ def index @protected_branch = @project.protected_branches.new @protected_branches = @project.protected_branches.order(:name).page(params[:page]) set_index_vars + load_gon_index(@project) end def new diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index 76e74e796595..c2173a54b9ee 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -10,8 +10,7 @@ def index @hooks = @project.hooks @hook = ProjectHook.new - @project.build_missing_services - @services = @project.services.visible.reload + @services = @project.find_or_initialize_services end def create diff --git a/app/controllers/projects/pipelines_settings_controller.rb b/app/controllers/projects/pipelines_settings_controller.rb index c7eb459e3d07..31f086af9e2e 100644 --- a/app/controllers/projects/pipelines_settings_controller.rb +++ b/app/controllers/projects/pipelines_settings_controller.rb @@ -2,7 +2,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController before_action :authorize_admin_pipeline! def show - redirect_to namespace_project_runners_path(@project.namespace, @project) + redirect_to namespace_project_runners_path(@project.namespace, @project, params) end def update diff --git a/app/controllers/projects/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb index 9a438d5512c7..ae360e4f26ed 100644 --- a/app/controllers/projects/protected_branches_controller.rb +++ b/app/controllers/projects/protected_branches_controller.rb @@ -1,4 +1,6 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController + include ProtectedBranchesHelper + # Authorize before_action :require_non_empty_project before_action :authorize_admin_project! @@ -9,16 +11,16 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController def index @protected_branch = @project.protected_branches.new - load_gon_index + load_gon_index(@project) end def create @protected_branch = ::ProtectedBranches::CreateService.new(@project, current_user, protected_branch_params).execute if @protected_branch.persisted? - redirect_to namespace_project_protected_branches_path(@project.namespace, @project) + redirect_to_protected_branches else load_protected_branches - load_gon_index + load_gon_index(@project) render :index end end @@ -45,7 +47,7 @@ def destroy @protected_branch.destroy respond_to do |format| - format.html { redirect_to namespace_project_protected_branches_path } + format.html { redirect_to_protected_branches } format.js { head :ok } end end @@ -66,15 +68,12 @@ def load_protected_branches @protected_branches = @project.protected_branches.order(:name).page(params[:page]) end - def access_levels_options - { - push_access_levels: ProtectedBranch::PushAccessLevel.human_access_levels.map { |id, text| { id: id, text: text, before_divider: true } }, - merge_access_levels: ProtectedBranch::MergeAccessLevel.human_access_levels.map { |id, text| { id: id, text: text, before_divider: true } } - } - end - - def load_gon_index - params = { open_branches: @project.open_branches.map { |br| { text: br.name, id: br.name, title: br.name } } } - gon.push(params.merge(access_levels_options)) + def redirect_to_protected_branches + if Rails.application.routes.recognize_path(request.referer)[:controller] == 'projects/deploy-keys' + path = namespace_project_protected_branches_path(@project.namespace, @project) + else + path = namespace_project_deploy_keys_path(@project.namespace, @project) + end + redirect_to path end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 05696f8b1691..a8a18b4fa167 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -26,10 +26,6 @@ def edit render 'edit' end - def integrations - render 'settings/integrations' - end - def create @project = ::Projects::CreateService.new(current_user, project_params).execute diff --git a/app/helpers/protected_branches_helper.rb b/app/helpers/protected_branches_helper.rb new file mode 100644 index 000000000000..7f476807996f --- /dev/null +++ b/app/helpers/protected_branches_helper.rb @@ -0,0 +1,13 @@ +module ProtectedBranchesHelper + def access_levels_options + { + push_access_levels: ProtectedBranch::PushAccessLevel.human_access_levels.map { |id, text| { id: id, text: text, before_divider: true } }, + merge_access_levels: ProtectedBranch::MergeAccessLevel.human_access_levels.map { |id, text| { id: id, text: text, before_divider: true } } + } + end + + def load_gon_index(project) + params = { open_branches: project.open_branches.map { |br| { text: br.name, id: br.name, title: br.name } } } + gon.push(params.merge(access_levels_options)) + end +end diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature index 57dda9c2234f..dd59519e100e 100644 --- a/features/project/active_tab.feature +++ b/features/project/active_tab.feature @@ -41,22 +41,22 @@ Feature: Project Active Tab Scenario: On Project Settings/Hooks Given I visit my project's settings page - And I click the "Hooks" tab - Then the active sub nav should be Hooks - And no other sub navs should be active + And I click the "Integrations" tab + Then the active sub tab should be Integrations + And no other sub tabs should be active And the active main tab should be Settings Scenario: On Project Settings/Deploy Keys Given I visit my project's settings page - And I click the "Deploy Keys" tab - Then the active sub nav should be Deploy Keys - And no other sub navs should be active + And I click the "Repository" tab + Then the active sub tab should be Repository + And no other sub tabs should be active And the active main tab should be Settings Scenario: On Project Members Given I visit my project's members page Then the active sub nav should be Members - And no other sub navs should be active + And no other sub tabs should be active And the active main tab should be Settings # Sub Tabs: Repository diff --git a/features/steps/project/active_tab.rb b/features/steps/project/active_tab.rb index 582250328594..aad195b31107 100644 --- a/features/steps/project/active_tab.rb +++ b/features/steps/project/active_tab.rb @@ -27,24 +27,28 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps end end - step 'I click the "Hooks" tab' do - click_link('Webhooks') + step 'I click the "Integrations" tab' do + page.within '.sub-nav' do + click_link('Integrations') + end end - step 'I click the "Deploy Keys" tab' do - click_link('Deploy Keys') + step 'I click the "Repository" tab' do + page.within '.sub-nav' do + click_link('Repository') + end end - step 'the active sub nav should be Members' do - ensure_active_sub_nav('Members') + step 'the active sub tab should be Members' do + ensure_active_sub_tab('Members') end - step 'the active sub nav should be Hooks' do - ensure_active_sub_nav('Webhooks') + step 'the active sub tab should be Integrations' do + ensure_active_sub_tab('Integrations') end - step 'the active sub nav should be Deploy Keys' do - ensure_active_sub_nav('Deploy Keys') + step 'the active sub tab should be Repository' do + ensure_active_sub_tab('Repository') end # Sub Tabs: Commits diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb index d6024212601f..8c81976fba64 100644 --- a/features/steps/shared/project_tab.rb +++ b/features/steps/shared/project_tab.rb @@ -20,8 +20,8 @@ module SharedProjectTab ensure_active_main_tab('Issues') end - step 'the active main tab should be Members' do - ensure_active_main_tab('Members') + step 'the active sub nav should be Members' do + ensure_active_sub_tab('Members') end step 'the active main tab should be Merge Requests' do @@ -37,7 +37,7 @@ module SharedProjectTab end step 'the active main tab should be Settings' do - expect(page).to have_selector('.layout-nav .nav-links > li.active', count: 0) + ensure_active_main_tab('Settings') end step 'the active main tab should be Activity' do diff --git a/spec/features/protected_branches/access_control_ce_spec.rb b/spec/features/protected_branches/access_control_ce_spec.rb index 395c61a47438..7f0c6de1d3ee 100644 --- a/spec/features/protected_branches/access_control_ce_spec.rb +++ b/spec/features/protected_branches/access_control_ce_spec.rb @@ -1,7 +1,7 @@ RSpec.shared_examples "protected branches > access control > CE" do ProtectedBranch::PushAccessLevel.human_access_levels.each do |(access_type_id, access_type_name)| it "allows creating protected branches that #{access_type_name} can push to" do - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) set_protected_branch_name('master') within('.new_protected_branch') do allowed_to_push_button = find(".js-allowed-to-push") @@ -18,7 +18,7 @@ end it "allows updating protected branches so that #{access_type_name} can push to them" do - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) set_protected_branch_name('master') click_on "Protect" @@ -36,7 +36,7 @@ ProtectedBranch::MergeAccessLevel.human_access_levels.each do |(access_type_id, access_type_name)| it "allows creating protected branches that #{access_type_name} can merge to" do - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) set_protected_branch_name('master') within('.new_protected_branch') do allowed_to_merge_button = find(".js-allowed-to-merge") @@ -53,7 +53,7 @@ end it "allows updating protected branches so that #{access_type_name} can merge to them" do - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) set_protected_branch_name('master') click_on "Protect" diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index 1a3f7b970f6c..8b32f0d0d599 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -17,7 +17,7 @@ def set_protected_branch_name(branch_name) describe "explicit protected branches" do it "allows creating explicit protected branches" do - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) set_protected_branch_name('some-branch') click_on "Protect" @@ -30,7 +30,7 @@ def set_protected_branch_name(branch_name) commit = create(:commit, project: project) project.repository.add_branch(user, 'some-branch', commit.id) - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) set_protected_branch_name('some-branch') click_on "Protect" @@ -38,7 +38,7 @@ def set_protected_branch_name(branch_name) end it "displays an error message if the named branch does not exist" do - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) set_protected_branch_name('some-branch') click_on "Protect" @@ -48,7 +48,7 @@ def set_protected_branch_name(branch_name) describe "wildcard protected branches" do it "allows creating protected branches with a wildcard" do - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) set_protected_branch_name('*-stable') click_on "Protect" @@ -61,7 +61,7 @@ def set_protected_branch_name(branch_name) project.repository.add_branch(user, 'production-stable', 'master') project.repository.add_branch(user, 'staging-stable', 'master') - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) set_protected_branch_name('*-stable') click_on "Protect" @@ -73,11 +73,11 @@ def set_protected_branch_name(branch_name) project.repository.add_branch(user, 'staging-stable', 'master') project.repository.add_branch(user, 'development', 'master') - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) set_protected_branch_name('*-stable') click_on "Protect" - visit namespace_project_protected_branches_path(project.namespace, project) + visit namespace_project_deploy_keys_path(project.namespace, project) click_on "2 matching branches" within(".protected-branches-list") do -- GitLab