diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index ba4c63b680de3499898434c3fb9212d7d3674f9f..3cd6fc922156ae3fd5dd11bda72ea73976632c76 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -1,20 +1,4 @@ -- 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 - +- can_edit = can?(current_user, :admin_project, @project) .scrolling-tabs-container{ class: nav_control_class } .fade-left = icon('angle-left') @@ -71,6 +55,23 @@ %span Snippets + - if project_nav_tab? :settings + = nav_link(path: %w[projects#edit members#show integrations#show repository#show ci_cd#show pages#show audit_events#index]) do + = link_to edit_project_path(@project), title: 'Settings', class: 'shortcuts-tree' do + %span + Settings + - else + = nav_link(path: %w[members#show]) do + = link_to namespace_project_settings_members_path(@project.namespace, @project), title: 'Settings', class: 'shortcuts-tree' do + %span + Settings + + -# Shortcut to Project > Activity + %li.hidden + = link_to activity_project_path(@project), title: 'Activity', class: 'shortcuts-project-activity' do + %span + Activity + -# Global shortcut to network page for compatibility - if project_nav_tab? :network %li.hidden diff --git a/app/views/layouts/nav/_project_settings.html.haml b/app/views/layouts/nav/_project_settings.html.haml deleted file mode 100644 index e921fb9c6be3dede22c30d092c59f63440452ad1..0000000000000000000000000000000000000000 --- a/app/views/layouts/nav/_project_settings.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -- if project_nav_tab? :team - = nav_link(controller: [:members, :teams]) do - = link_to namespace_project_settings_members_path(@project.namespace, @project), title: 'Members', class: 'team-tab tab' do - %span - Members -- if can_edit - = nav_link(controller: :repository) do - = link_to namespace_project_settings_repository_path(@project.namespace, @project), title: 'Repository' do - %span - Repository - = nav_link(controller: :integrations) do - = link_to namespace_project_settings_integrations_path(@project.namespace, @project), title: 'Integrations' do - %span - Integrations - - - if @project.feature_available?(:builds, current_user) - = nav_link(controller: :ci_cd) do - = link_to namespace_project_settings_ci_cd_path(@project.namespace, @project), title: 'CI/CD Pipelines' do - %span - CI/CD Pipelines - = nav_link(controller: :pages) do - = link_to namespace_project_pages_path(@project.namespace, @project), title: 'Pages', data: {placement: 'right'} do - %span - Pages - = nav_link(controller: :audit_events) do - = link_to namespace_project_audit_events_path(@project.namespace, @project), title: "Audit Events" do - %span - Audit Events diff --git a/app/views/projects/audit_events/index.html.haml b/app/views/projects/audit_events/index.html.haml index 2a015fc8f10234c78e469636762153f3288bce68..1084c54a86af1d8da0a5a86c7d1386179c4dd965 100644 --- a/app/views/projects/audit_events/index.html.haml +++ b/app/views/projects/audit_events/index.html.haml @@ -1,4 +1,6 @@ - page_title "Audit Events" += render "projects/settings/head" + %h3.page-title Project Audit Events %p.light Events in #{@project.path_with_namespace} diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 2223ef1b570e5e2b1518579577c1347b626c2fe3..0ae64cb01eea7928dc1604006a47ec5a9222329b 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -1,3 +1,4 @@ += render "projects/settings/head" .project-edit-container .row.prepend-top-default .col-lg-3.profile-settings-sidebar diff --git a/app/views/projects/pages/show.html.haml b/app/views/projects/pages/show.html.haml index b6595269b06cbc07404e555820e02b664683bf40..259d5bd63d61a361f59b38f1169bf328b3cc4d93 100644 --- a/app/views/projects/pages/show.html.haml +++ b/app/views/projects/pages/show.html.haml @@ -1,4 +1,6 @@ - page_title 'Pages' += render "projects/settings/head" + %h3.page_title Pages diff --git a/app/views/projects/settings/_head.html.haml b/app/views/projects/settings/_head.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..a3037f127044408fac42c18249120cd96dd5ccc8 --- /dev/null +++ b/app/views/projects/settings/_head.html.haml @@ -0,0 +1,37 @@ += 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 } + - can_edit = can?(current_user, :admin_project, @project) + - if can_edit + = nav_link(controller: :projects) do + = link_to edit_project_path(@project), title: 'General' do + %span + General + = nav_link(controller: :members) do + = link_to project_settings_members_path(@project), title: 'Members' do + %span + Members + - if can_edit + = nav_link(controller: :integrations) do + = link_to project_settings_integrations_path(@project), title: 'Integrations' do + %span + Integrations + = nav_link(controller: :repository) do + = link_to namespace_project_settings_repository_path(@project.namespace, @project), title: 'Repository' do + %span + Repository + = nav_link(controller: :audit_events) do + = link_to namespace_project_audit_events_path(@project.namespace, @project), title: 'Audit Events' do + %span + Audit Events + - if @project.feature_available?(:builds, current_user) + = nav_link(controller: :ci_cd) do + = link_to namespace_project_settings_ci_cd_path(@project.namespace, @project), title: 'CI/CD Pipelines' do + %span + CI/CD Pipelines + = nav_link(controller: :pages) do + = link_to namespace_project_pages_path(@project.namespace, @project), title: 'Pages' do + %span + Pages diff --git a/app/views/projects/settings/ci_cd/show.html.haml b/app/views/projects/settings/ci_cd/show.html.haml index 52f5f7b81e2afb493fe05a4e1ea792fd521f27eb..e26030960145c37209c1af0b1b5e01336df01c76 100644 --- a/app/views/projects/settings/ci_cd/show.html.haml +++ b/app/views/projects/settings/ci_cd/show.html.haml @@ -1,4 +1,5 @@ - page_title "CI/CD Pipelines" += render "projects/settings/head" = render 'projects/runners/index' = render 'projects/variables/index' diff --git a/app/views/projects/settings/integrations/show.html.haml b/app/views/projects/settings/integrations/show.html.haml index aa38a889cdd70cf9c6535cc910b818f78d208317..f69992566b5edaf472ee853a69263086d7a32663 100644 --- a/app/views/projects/settings/integrations/show.html.haml +++ b/app/views/projects/settings/integrations/show.html.haml @@ -1,3 +1,4 @@ - page_title 'Integrations' += render "projects/settings/head" = render 'projects/hooks/index' = render 'projects/services/index' diff --git a/app/views/projects/settings/members/show.html.haml b/app/views/projects/settings/members/show.html.haml index d81ed7bb6097af815cb5fc6d40e47037e5082365..20e1ad682443acd887eca582bd3c8c454ee34d3f 100644 --- a/app/views/projects/settings/members/show.html.haml +++ b/app/views/projects/settings/members/show.html.haml @@ -1,4 +1,5 @@ - page_title "Members" += render "projects/settings/head" = render "projects/project_members/index" - if can?(current_user, :admin_project, @project) diff --git a/app/views/projects/settings/repository/show.html.haml b/app/views/projects/settings/repository/show.html.haml index eac537739052117194f946acca313f86f54f79d8..9c6b6442ab76740b133220de5c02aef47d3b5343 100644 --- a/app/views/projects/settings/repository/show.html.haml +++ b/app/views/projects/settings/repository/show.html.haml @@ -1,4 +1,5 @@ - page_title "Repository" += render "projects/settings/head" = render @deploy_keys = render "projects/push_rules/index" diff --git a/changelogs/unreleased/settings-tab.yml b/changelogs/unreleased/settings-tab.yml new file mode 100644 index 0000000000000000000000000000000000000000..dbfca3ba4004d46a543f727fe8e56b88f50ae57e --- /dev/null +++ b/changelogs/unreleased/settings-tab.yml @@ -0,0 +1,4 @@ +--- +title: Moved project settings from the gear drop-down menu to a tab +merge_request: +author: diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature index 4bdaa6266c3d2835b4008e62a4515f7354f70581..4a0adaf624a3e8de79f289684974da965f51d957 100644 --- a/features/project/active_tab.feature +++ b/features/project/active_tab.feature @@ -42,28 +42,28 @@ Feature: Project Active Tab Scenario: On Project Settings/Integrations Given I visit my project's settings page And I click the "Integrations" tab - Then the active sub nav should be Integrations - And no other sub navs should be active + 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/Repository Given I visit my project's settings page And I click the "Repository" tab - Then the active sub nav should be Repository - And no other sub navs should be active + 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 Settings/Pages Given I visit my project's settings page And I click the "Pages" tab - Then the active sub nav should be Pages - And no other sub navs should be active + Then the active sub tab should be Pages + 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 + Then the active sub tab should be Members + 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 218d5c6164b0a55684868c3d2190a61e131a3a40..706e6e890e2bbd0ec7ffd470dd40d0fb71b400ac 100644 --- a/features/steps/project/active_tab.rb +++ b/features/steps/project/active_tab.rb @@ -22,39 +22,43 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps end step 'I click the "Edit Project"' do - page.within '.layout-nav .controls' do + page.within '.sub-nav' do click_link('Edit Project') end end step 'I click the "Integrations" tab' do - click_link('Integrations') + page.within '.sub-nav' do + click_link('Integrations') + end end step 'I click the "Repository" tab' do - page.within '.layout-nav .controls' do + page.within '.sub-nav' do click_link('Repository') end end step 'I click the "Pages" tab' do - click_link('Pages') + page.within '.sub-nav' do + click_link('Pages') + 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 Integrations' do - ensure_active_sub_nav('Integrations') + step 'the active sub tab should be Integrations' do + ensure_active_sub_tab('Integrations') end - step 'the active sub nav should be Repository' do - ensure_active_sub_nav('Repository') + step 'the active sub tab should be Repository' do + ensure_active_sub_tab('Repository') end - step 'the active sub nav should be Pages' do - ensure_active_sub_nav('Pages') + step 'the active sub tab should be Pages' do + ensure_active_sub_tab('Pages') end # Sub Tabs: Commits diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb index 83446afe424fd73b306ff3ea28cc9462926475f6..56e9d24740435e6bd58c29f801ff5f98ecd0bae4 100644 --- a/features/steps/shared/project_tab.rb +++ b/features/steps/shared/project_tab.rb @@ -16,8 +16,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 tab should be Members' do + ensure_active_sub_tab('Members') end step 'the active main tab should be Merge Requests' do @@ -33,7 +33,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 sub tab should be Graph' do diff --git a/spec/features/projects/members/user_requests_access_spec.rb b/spec/features/projects/members/user_requests_access_spec.rb index 0b4dcaa39c693a264d1732569debc43e06d5d682..b64c15e0adc848fff99a52238c134a66a3b953a2 100644 --- a/spec/features/projects/members/user_requests_access_spec.rb +++ b/spec/features/projects/members/user_requests_access_spec.rb @@ -57,6 +57,12 @@ end def open_project_settings_menu - find('#project-settings-button').click + page.within('.layout-nav .nav-links') do + click_link('Settings') + end + + page.within('.page-with-layout-nav .sub-nav') do + click_link('Members') + end end end