Render only issues/mr in subnav depends on context
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
1976a44649
commit
d4b2f5d0f3
5 changed files with 21 additions and 17 deletions
|
@ -63,7 +63,7 @@
|
||||||
Graphs
|
Graphs
|
||||||
|
|
||||||
- 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
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
%ul.nav-links.sub-nav
|
%ul.nav-links.sub-nav
|
||||||
%div{ class: (container_class) }
|
%div{ class: (container_class) }
|
||||||
- if project_nav_tab?(:issues)
|
- if project_nav_tab?(:issues) && current_controller?(:issues)
|
||||||
= nav_link(controller: :issues) do
|
= nav_link(controller: :issues) do
|
||||||
= link_to url_for_project_issues(@project, only_path: true), title: 'Issues' do
|
= link_to url_for_project_issues(@project, only_path: true), title: 'Issues' do
|
||||||
%span
|
%span
|
||||||
Issues
|
Issues
|
||||||
|
|
||||||
- if project_nav_tab?(:merge_requests)
|
- if project_nav_tab?(:merge_requests) && current_controller?(:merge_requests)
|
||||||
= nav_link(controller: :merge_requests) do
|
= nav_link(controller: :merge_requests) do
|
||||||
= link_to namespace_project_merge_requests_path(@project.namespace, @project), title: 'Merge Requests' do
|
= link_to namespace_project_merge_requests_path(@project.namespace, @project), title: 'Merge Requests' do
|
||||||
%span
|
%span
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
# 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
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue