Commit 8f3c0490 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'labels-placement' into 'master'

Move Labels and Milestones as sub tab to Issues/MR

## What does this MR do?

UI/UX change. Moves project labels and milestone tabs under Issues and Merge request tabs. 

## Why was this MR needed?

To solve problem of having to many tabs in top navigation. Since Labels and Milestones depends on Issue/MR feature it belongs to it and can be removed from top nav.

## What are the relevant issue numbers?

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/18368

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - not needed
- [x] API support added - not needed
- [x] Tests
  - [x] Added for this feature/bug - changed existing tests to match new behaviour
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)

cc @jschatz1 @annabeldunstone @skyruler

See merge request !4592
parents 37be2007 308bb567
...@@ -64,6 +64,7 @@ v 8.9.0 (unreleased) ...@@ -64,6 +64,7 @@ v 8.9.0 (unreleased)
- Toggling a task list item in a issue/mr description does not creates a Todo for mentions - Toggling a task list item in a issue/mr description does not creates a Todo for mentions
- Improved UX of date pickers on issue & milestone forms - Improved UX of date pickers on issue & milestone forms
- Cache on the database if a project has an active external issue tracker. - Cache on the database if a project has an active external issue tracker.
- Put project Labels and Milestones pages links under Issues and Merge Requests tabs as subnav
v 8.8.5 (unreleased) v 8.8.5 (unreleased)
- Ensure branch cleanup regardless of whether the GitHub import process succeeds - Ensure branch cleanup regardless of whether the GitHub import process succeeds
......
...@@ -62,15 +62,8 @@ ...@@ -62,15 +62,8 @@
%span %span
Graphs Graphs
- if project_nav_tab? :milestones
= nav_link(controller: :milestones) do
= link_to namespace_project_milestones_path(@project.namespace, @project), title: 'Milestones' do
= navbar_icon('milestones')
%span
Milestones
- if project_nav_tab? :issues - if project_nav_tab? :issues
= nav_link(controller: :issues) do = nav_link(controller: [:issues, :labels, :milestones]) do
= link_to url_for_project_issues(@project, only_path: true), title: 'Issues', class: 'shortcuts-issues' do = link_to url_for_project_issues(@project, only_path: true), title: 'Issues', class: 'shortcuts-issues' do
= navbar_icon('issues') = navbar_icon('issues')
%span %span
...@@ -86,13 +79,6 @@ ...@@ -86,13 +79,6 @@
Merge Requests Merge Requests
%span.badge.count.merge_counter= number_with_delimiter(@project.merge_requests.opened.count) %span.badge.count.merge_counter= number_with_delimiter(@project.merge_requests.opened.count)
- if project_nav_tab? :labels
= nav_link(controller: :labels) do
= link_to namespace_project_labels_path(@project.namespace, @project), title: 'Labels' do
= icon('tags fw')
%span
Labels
- if project_nav_tab? :wiki - if project_nav_tab? :wiki
= nav_link(controller: :wikis) do = nav_link(controller: :wikis) do
= link_to get_project_wiki_path(@project), title: 'Wiki', class: 'shortcuts-wiki' do = link_to get_project_wiki_path(@project), title: 'Wiki', class: 'shortcuts-wiki' do
......
%ul.nav-links.sub-nav
%div{ class: (container_class) }
- if project_nav_tab?(:issues) && !current_controller?(:merge_requests)
= nav_link(controller: :issues) do
= link_to url_for_project_issues(@project, only_path: true), title: 'Issues' do
%span
Issues
- if project_nav_tab?(:merge_requests) && current_controller?(:merge_requests)
= nav_link(controller: :merge_requests) do
= link_to namespace_project_merge_requests_path(@project.namespace, @project), title: 'Merge Requests' do
%span
Merge Requests
- if project_nav_tab? :labels
= nav_link(controller: :labels) do
= link_to namespace_project_labels_path(@project.namespace, @project), title: 'Labels' do
%span
Labels
- if project_nav_tab? :milestones
= nav_link(controller: :milestones) do
= link_to namespace_project_milestones_path(@project.namespace, @project), title: 'Milestones' do
%span
Milestones
- @no_container = true
- page_title "Issues" - page_title "Issues"
= render "projects/issues/head"
= content_for :meta_tags do = content_for :meta_tags do
- if current_user - if current_user
= auto_discovery_link_tag(:atom, namespace_project_issues_url(@project.namespace, @project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues") = auto_discovery_link_tag(:atom, namespace_project_issues_url(@project.namespace, @project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues")
.top-area %div{ class: (container_class) }
.top-area
= render 'shared/issuable/nav', type: :issues = render 'shared/issuable/nav', type: :issues
.nav-controls .nav-controls
- if current_user - if current_user
...@@ -17,7 +20,7 @@ ...@@ -17,7 +20,7 @@
= link_to new_namespace_project_issue_path(@project.namespace, @project, issue: { assignee_id: @issuable_finder.assignee.try(:id), milestone_id: @issuable_finder.milestones.try(:first).try(:id) }), class: "btn btn-new", title: "New Issue", id: "new_issue_link" do = link_to new_namespace_project_issue_path(@project.namespace, @project, issue: { assignee_id: @issuable_finder.assignee.try(:id), milestone_id: @issuable_finder.milestones.try(:first).try(:id) }), class: "btn btn-new", title: "New Issue", id: "new_issue_link" do
New Issue New Issue
= render 'shared/issuable/filter', type: :issues = render 'shared/issuable/filter', type: :issues
.issues-holder .issues-holder
= render "issues" = render "issues"
- @no_container = true
- page_title "Labels" - page_title "Labels"
- hide_class = '' - hide_class = ''
= render "projects/issues/head"
.top-area %div{ class: (container_class) }
.top-area
.nav-text .nav-text
Labels can be applied to issues and merge requests. Labels can be applied to issues and merge requests.
.nav-controls .nav-controls
...@@ -9,7 +12,7 @@ ...@@ -9,7 +12,7 @@
= link_to new_namespace_project_label_path(@project.namespace, @project), class: "btn btn-new" do = link_to new_namespace_project_label_path(@project.namespace, @project), class: "btn btn-new" do
New label New label
.labels .labels
- if can?(current_user, :admin_label, @project) - if can?(current_user, :admin_label, @project)
-# Only show it in the first page -# Only show it in the first page
- hide = @project.labels.empty? || (params[:page].present? && params[:page] != '1') - hide = @project.labels.empty? || (params[:page].present? && params[:page] != '1')
......
.top-tabs
= link_to namespace_project_merge_requests_path(@project.namespace, @project), class: "tab #{'active' if current_page?(namespace_project_merge_requests_path(@project.namespace, @project)) }" do
%span
Merge Requests
- @no_container = true
- page_title "Merge Requests" - page_title "Merge Requests"
= render "projects/issues/head"
= render 'projects/last_push' = render 'projects/last_push'
.top-area %div{ class: (container_class) }
.top-area
= render 'shared/issuable/nav', type: :merge_requests = render 'shared/issuable/nav', type: :merge_requests
.nav-controls .nav-controls
= render 'shared/issuable/search_form', path: namespace_project_merge_requests_path(@project.namespace, @project) = render 'shared/issuable/search_form', path: namespace_project_merge_requests_path(@project.namespace, @project)
...@@ -12,7 +14,7 @@ ...@@ -12,7 +14,7 @@
= link_to new_namespace_project_merge_request_path(merge_project.namespace, merge_project), class: "btn btn-new", title: "New Merge Request" do = link_to new_namespace_project_merge_request_path(merge_project.namespace, merge_project), class: "btn btn-new", title: "New Merge Request" do
New Merge Request New Merge Request
= render 'shared/issuable/filter', type: :merge_requests = render 'shared/issuable/filter', type: :merge_requests
.merge-requests-holder .merge-requests-holder
= render 'merge_requests' = render 'merge_requests'
- @no_container = true
- page_title "Milestones" - page_title "Milestones"
= render "projects/issues/head"
.top-area %div{ class: (container_class) }
.top-area
= render 'shared/milestones_filter' = render 'shared/milestones_filter'
.nav-controls .nav-controls
...@@ -8,7 +11,7 @@ ...@@ -8,7 +11,7 @@
= link_to new_namespace_project_milestone_path(@project.namespace, @project), class: "btn btn-new", title: "New Milestone" do = link_to new_namespace_project_milestone_path(@project.namespace, @project), class: "btn btn-new", title: "New Milestone" do
New Milestone New Milestone
.milestones .milestones
%ul.content-list %ul.content-list
= render @milestones = render @milestones
......
...@@ -107,12 +107,16 @@ Feature: Project Active Tab ...@@ -107,12 +107,16 @@ Feature: Project Active Tab
Scenario: On Project Issues/Milestones Scenario: On Project Issues/Milestones
Given I visit my project's issues page Given I visit my project's issues page
And I click the "Milestones" tab And I click the "Milestones" sub tab
Then the active main tab should be Milestones Then the active main tab should be Issues
Then the active sub tab should be Milestones
And no other main tabs should be active And no other main tabs should be active
And no other sub tabs should be active
Scenario: On Project Issues/Labels Scenario: On Project Issues/Labels
Given I visit my project's issues page Given I visit my project's issues page
And I click the "Labels" tab And I click the "Labels" sub tab
Then the active main tab should be Labels Then the active main tab should be Issues
Then the active sub tab should be Labels
And no other main tabs should be active And no other main tabs should be active
And no other sub tabs should be active
...@@ -77,14 +77,14 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps ...@@ -77,14 +77,14 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps
# Sub Tabs: Issues # Sub Tabs: Issues
step 'I click the "Milestones" tab' do step 'I click the "Milestones" sub tab' do
page.within('.layout-nav') do page.within('.sub-nav') do
click_link('Milestones') click_link('Milestones')
end end
end end
step 'I click the "Labels" tab' do step 'I click the "Labels" sub tab' do
page.within('.layout-nav') do page.within('.sub-nav') do
click_link('Labels') click_link('Labels')
end end
end end
...@@ -93,11 +93,11 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps ...@@ -93,11 +93,11 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps
ensure_active_sub_tab('Issues') ensure_active_sub_tab('Issues')
end end
step 'the active main tab should be Milestones' do step 'the active sub tab should be Milestones' do
ensure_active_main_tab('Milestones') ensure_active_sub_tab('Milestones')
end end
step 'the active main tab should be Labels' do step 'the active sub tab should be Labels' do
ensure_active_main_tab('Labels') ensure_active_sub_tab('Labels')
end end
end end
...@@ -6,7 +6,7 @@ module SharedActiveTab ...@@ -6,7 +6,7 @@ module SharedActiveTab
end end
def ensure_active_sub_tab(content) def ensure_active_sub_tab(content)
expect(find('div.content ul.nav-links li.active')).to have_content(content) expect(find('.sub-nav li.active')).to have_content(content)
end end
def ensure_active_sub_nav(content) def ensure_active_sub_nav(content)
...@@ -18,7 +18,7 @@ module SharedActiveTab ...@@ -18,7 +18,7 @@ module SharedActiveTab
end end
step 'no other sub tabs should be active' do step 'no other sub tabs should be active' do
expect(page).to have_selector('div.content ul.nav-links li.active', count: 1) expect(page).to have_selector('.sub-nav li.active', count: 1)
end end
step 'no other sub navs should be active' do step 'no other sub navs should be active' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment