Commit 51c1e499 authored by Robert Speicher's avatar Robert Speicher

Change active tab and nav class to "active"

The main nav used active, the sub nav used current. This normalizes it.
parent adcc6a0b
...@@ -53,7 +53,7 @@ ul.main_menu { ...@@ -53,7 +53,7 @@ ul.main_menu {
border-left: 0; border-left: 0;
} }
&.current { &.active {
background-color:#D5D5D5; background-color:#D5D5D5;
border-right: 1px solid #BBB; border-right: 1px solid #BBB;
border-left: 1px solid #BBB; border-left: 1px solid #BBB;
......
...@@ -5,7 +5,6 @@ module TabHelper ...@@ -5,7 +5,6 @@ module TabHelper
# Project Area # Project Area
when :wall; wall_tab? when :wall; wall_tab?
when :wiki; controller.controller_name == "wikis" when :wiki; controller.controller_name == "wikis"
when :issues; issues_tab?
when :network; current_page?(controller: "projects", action: "graph", id: @project) when :network; current_page?(controller: "projects", action: "graph", id: @project)
when :merge_requests; controller.controller_name == "merge_requests" when :merge_requests; controller.controller_name == "merge_requests"
...@@ -35,11 +34,7 @@ module TabHelper ...@@ -35,11 +34,7 @@ module TabHelper
else else
false false
end end
active ? "current" : nil active ? "active" : nil
end
def issues_tab?
controller.controller_name == "issues" || controller.controller_name == "milestones"
end end
def wall_tab? def wall_tab?
...@@ -48,21 +43,17 @@ module TabHelper ...@@ -48,21 +43,17 @@ module TabHelper
def project_tab_class def project_tab_class
[:show, :files, :edit, :update].each do |action| [:show, :files, :edit, :update].each do |action|
return "current" if current_page?(controller: "projects", action: action, id: @project) return "active" if current_page?(controller: "projects", action: action, id: @project)
end end
if ['snippets', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name if ['snippets', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name
"current" "active"
end end
end end
def tree_tab_class
controller.controller_name == "refs" ? "current" : nil
end
def commit_tab_class def commit_tab_class
if ['commits', 'repositories', 'protected_branches'].include? controller.controller_name if ['commits', 'repositories', 'protected_branches'].include? controller.controller_name
"current" "active"
end end
end end
......
...@@ -4,17 +4,15 @@ ...@@ -4,17 +4,15 @@
- if @project.repo_exists? - if @project.repo_exists?
- if can? current_user, :download_code, @project - if can? current_user, :download_code, @project
%li{class: tree_tab_class} %li{class: current_controller?(:tree, :blob, :blame) ? 'active' : ''}
= link_to project_tree_path(@project, @project.root_ref) do = link_to 'Files', project_tree_path(@project, @project.root_ref)
Files
%li{class: commit_tab_class} %li{class: commit_tab_class}
= link_to "Commits", project_commits_path(@project, @project.root_ref) = link_to "Commits", project_commits_path(@project, @project.root_ref)
%li{class: tab_class(:network)} %li{class: tab_class(:network)}
= link_to "Network", graph_project_path(@project) = link_to "Network", graph_project_path(@project)
- if @project.issues_enabled - if @project.issues_enabled
%li{class: tab_class(:issues)} %li{class: current_controller?(:issues, :milestones, :labels) ? 'active' : ''}
= link_to project_issues_filter_path(@project) do = link_to project_issues_filter_path(@project) do
Issues Issues
%span.count.issue_counter= @project.issues.opened.count %span.count.issue_counter= @project.issues.opened.count
......
...@@ -2,10 +2,18 @@ module SharedActiveTab ...@@ -2,10 +2,18 @@ module SharedActiveTab
include Spinach::DSL include Spinach::DSL
def ensure_active_main_tab(content) def ensure_active_main_tab(content)
page.find('ul.main_menu li.current').should have_content(content) page.find('ul.main_menu li.active').should have_content(content)
end
def ensure_active_sub_tab(content)
page.find('div.content ul.nav-tabs li.active').should have_content(content)
end end
And 'no other main tabs should be active' do And 'no other main tabs should be active' do
page.should have_selector('ul.main_menu li.current', count: 1) page.should have_selector('ul.main_menu li.active', count: 1)
end
And 'no other sub tabs should be active' do
page.should have_selector('div.content ul.nav-tabs li.active', count: 1)
end end
end end
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