Commit 51c1e499006df02ff3dfc2a781457a01cc77550f
1 parent
adcc6a0b
Exists in
master
and in
4 other branches
Change active tab and nav class to "active"
The main nav used active, the sub nav used current. This normalizes it.
Showing
4 changed files
with
18 additions
and
21 deletions
Show diff stats
app/assets/stylesheets/sections/nav.scss
app/helpers/tab_helper.rb
... | ... | @@ -5,7 +5,6 @@ module TabHelper |
5 | 5 | # Project Area |
6 | 6 | when :wall; wall_tab? |
7 | 7 | when :wiki; controller.controller_name == "wikis" |
8 | - when :issues; issues_tab? | |
9 | 8 | when :network; current_page?(controller: "projects", action: "graph", id: @project) |
10 | 9 | when :merge_requests; controller.controller_name == "merge_requests" |
11 | 10 | |
... | ... | @@ -35,11 +34,7 @@ module TabHelper |
35 | 34 | else |
36 | 35 | false |
37 | 36 | end |
38 | - active ? "current" : nil | |
39 | - end | |
40 | - | |
41 | - def issues_tab? | |
42 | - controller.controller_name == "issues" || controller.controller_name == "milestones" | |
37 | + active ? "active" : nil | |
43 | 38 | end |
44 | 39 | |
45 | 40 | def wall_tab? |
... | ... | @@ -48,21 +43,17 @@ module TabHelper |
48 | 43 | |
49 | 44 | def project_tab_class |
50 | 45 | [:show, :files, :edit, :update].each do |action| |
51 | - return "current" if current_page?(controller: "projects", action: action, id: @project) | |
46 | + return "active" if current_page?(controller: "projects", action: action, id: @project) | |
52 | 47 | end |
53 | 48 | |
54 | 49 | if ['snippets', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name |
55 | - "current" | |
50 | + "active" | |
56 | 51 | end |
57 | 52 | end |
58 | 53 | |
59 | - def tree_tab_class | |
60 | - controller.controller_name == "refs" ? "current" : nil | |
61 | - end | |
62 | - | |
63 | 54 | def commit_tab_class |
64 | 55 | if ['commits', 'repositories', 'protected_branches'].include? controller.controller_name |
65 | - "current" | |
56 | + "active" | |
66 | 57 | end |
67 | 58 | end |
68 | 59 | ... | ... |
app/views/layouts/_project_menu.html.haml
... | ... | @@ -4,17 +4,15 @@ |
4 | 4 | |
5 | 5 | - if @project.repo_exists? |
6 | 6 | - if can? current_user, :download_code, @project |
7 | - %li{class: tree_tab_class} | |
8 | - = link_to project_tree_path(@project, @project.root_ref) do | |
9 | - Files | |
7 | + %li{class: current_controller?(:tree, :blob, :blame) ? 'active' : ''} | |
8 | + = link_to 'Files', project_tree_path(@project, @project.root_ref) | |
10 | 9 | %li{class: commit_tab_class} |
11 | 10 | = link_to "Commits", project_commits_path(@project, @project.root_ref) |
12 | - | |
13 | 11 | %li{class: tab_class(:network)} |
14 | 12 | = link_to "Network", graph_project_path(@project) |
15 | 13 | |
16 | 14 | - if @project.issues_enabled |
17 | - %li{class: tab_class(:issues)} | |
15 | + %li{class: current_controller?(:issues, :milestones, :labels) ? 'active' : ''} | |
18 | 16 | = link_to project_issues_filter_path(@project) do |
19 | 17 | Issues |
20 | 18 | %span.count.issue_counter= @project.issues.opened.count | ... | ... |
features/steps/shared/active_tab.rb
... | ... | @@ -2,10 +2,18 @@ module SharedActiveTab |
2 | 2 | include Spinach::DSL |
3 | 3 | |
4 | 4 | def ensure_active_main_tab(content) |
5 | - page.find('ul.main_menu li.current').should have_content(content) | |
5 | + page.find('ul.main_menu li.active').should have_content(content) | |
6 | + end | |
7 | + | |
8 | + def ensure_active_sub_tab(content) | |
9 | + page.find('div.content ul.nav-tabs li.active').should have_content(content) | |
6 | 10 | end |
7 | 11 | |
8 | 12 | And 'no other main tabs should be active' do |
9 | - page.should have_selector('ul.main_menu li.current', count: 1) | |
13 | + page.should have_selector('ul.main_menu li.active', count: 1) | |
14 | + end | |
15 | + | |
16 | + And 'no other sub tabs should be active' do | |
17 | + page.should have_selector('div.content ul.nav-tabs li.active', count: 1) | |
10 | 18 | end |
11 | 19 | end | ... | ... |