Commit d4b2f5d0 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Render only issues/mr in subnav depends on context

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 1976a446
......@@ -63,7 +63,7 @@
Graphs
- 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
= navbar_icon('issues')
%span
......
%ul.nav-links.sub-nav
%div{ class: (container_class) }
- if project_nav_tab?(:issues)
- if project_nav_tab?(:issues) && current_controller?(:issues)
= 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)
- 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
......
......@@ -107,12 +107,16 @@ Feature: Project Active Tab
Scenario: On Project Issues/Milestones
Given I visit my project's issues page
And I click the "Milestones" tab
Then the active main tab should be Milestones
And I click the "Milestones" sub tab
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 sub tabs should be active
Scenario: On Project Issues/Labels
Given I visit my project's issues page
And I click the "Labels" tab
Then the active main tab should be Labels
And I click the "Labels" sub tab
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 sub tabs should be active
......@@ -77,14 +77,14 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps
# Sub Tabs: Issues
step 'I click the "Milestones" tab' do
page.within('.layout-nav') do
step 'I click the "Milestones" sub tab' do
page.within('.sub-nav') do
click_link('Milestones')
end
end
step 'I click the "Labels" tab' do
page.within('.layout-nav') do
step 'I click the "Labels" sub tab' do
page.within('.sub-nav') do
click_link('Labels')
end
end
......@@ -93,11 +93,11 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps
ensure_active_sub_tab('Issues')
end
step 'the active main tab should be Milestones' do
ensure_active_main_tab('Milestones')
step 'the active sub tab should be Milestones' do
ensure_active_sub_tab('Milestones')
end
step 'the active main tab should be Labels' do
ensure_active_main_tab('Labels')
step 'the active sub tab should be Labels' do
ensure_active_sub_tab('Labels')
end
end
......@@ -6,7 +6,7 @@ module SharedActiveTab
end
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
def ensure_active_sub_nav(content)
......@@ -18,7 +18,7 @@ module SharedActiveTab
end
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
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