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 {
border-left: 0;
}
&.current {
&.active {
background-color:#D5D5D5;
border-right: 1px solid #BBB;
border-left: 1px solid #BBB;
......
......@@ -5,7 +5,6 @@ module TabHelper
# Project Area
when :wall; wall_tab?
when :wiki; controller.controller_name == "wikis"
when :issues; issues_tab?
when :network; current_page?(controller: "projects", action: "graph", id: @project)
when :merge_requests; controller.controller_name == "merge_requests"
......@@ -35,11 +34,7 @@ module TabHelper
else
false
end
active ? "current" : nil
end
def issues_tab?
controller.controller_name == "issues" || controller.controller_name == "milestones"
active ? "active" : nil
end
def wall_tab?
......@@ -48,21 +43,17 @@ module TabHelper
def project_tab_class
[: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
if ['snippets', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name
"current"
"active"
end
end
def tree_tab_class
controller.controller_name == "refs" ? "current" : nil
end
def commit_tab_class
if ['commits', 'repositories', 'protected_branches'].include? controller.controller_name
"current"
"active"
end
end
......
......@@ -4,17 +4,15 @@
- if @project.repo_exists?
- if can? current_user, :download_code, @project
%li{class: tree_tab_class}
= link_to project_tree_path(@project, @project.root_ref) do
Files
%li{class: current_controller?(:tree, :blob, :blame) ? 'active' : ''}
= link_to 'Files', project_tree_path(@project, @project.root_ref)
%li{class: commit_tab_class}
= link_to "Commits", project_commits_path(@project, @project.root_ref)
%li{class: tab_class(:network)}
= link_to "Network", graph_project_path(@project)
- 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
Issues
%span.count.issue_counter= @project.issues.opened.count
......
......@@ -2,10 +2,18 @@ module SharedActiveTab
include Spinach::DSL
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
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
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