Replace various "active tab" checks with nav_link
Also remove now-unused tab_class helper
This commit is contained in:
parent
f064c84019
commit
36f68140d1
11 changed files with 61 additions and 121 deletions
|
@ -1,19 +1,19 @@
|
|||
%ul.main_menu
|
||||
%li.home{class: tab_class(:root)}
|
||||
= nav_link(path: 'dashboard#index', html_options: {class: 'home'}) do
|
||||
= link_to "Home", root_path, title: "Home"
|
||||
|
||||
%li{class: tab_class(:dash_issues)}
|
||||
= nav_link(path: 'dashboard#issues') do
|
||||
= link_to dashboard_issues_path do
|
||||
Issues
|
||||
%span.count= current_user.assigned_issues.opened.count
|
||||
|
||||
%li{class: tab_class(:dash_mr)}
|
||||
= nav_link(path: 'dashboard#merge_requests') do
|
||||
= link_to dashboard_merge_requests_path do
|
||||
Merge Requests
|
||||
%span.count= current_user.cared_merge_requests.count
|
||||
|
||||
%li{class: tab_class(:search)}
|
||||
= nav_link(path: 'search#show') do
|
||||
= link_to "Search", search_path
|
||||
|
||||
%li{class: tab_class(:help)}
|
||||
= nav_link(path: 'help#index') do
|
||||
= link_to "Help", help_path
|
||||
|
|
|
@ -1,35 +1,33 @@
|
|||
%ul.main_menu
|
||||
%li.home{class: project_tab_class}
|
||||
= nav_link(html_options: {class: "home #{project_tab_class}"}) do
|
||||
= link_to @project.code, project_path(@project), title: "Project"
|
||||
|
||||
- if @project.repo_exists?
|
||||
- if can? current_user, :download_code, @project
|
||||
%li{class: current_controller?(:tree, :blob, :blame) ? 'active' : ''}
|
||||
= nav_link(controller: %w(tree blob blame)) do
|
||||
= link_to 'Files', project_tree_path(@project, @ref || @project.root_ref)
|
||||
%li{class: current_controller?(:commit, :commits, :compare, :repositories, :protected_branches) ? 'active' : ''}
|
||||
= nav_link(controller: %w(commit commits compare repositories protected_branches)) do
|
||||
= link_to "Commits", project_commits_path(@project, @ref || @project.root_ref)
|
||||
%li{class: tab_class(:network)}
|
||||
= nav_link(path: 'projects#graph') do
|
||||
= link_to "Network", graph_project_path(@project)
|
||||
|
||||
- if @project.issues_enabled
|
||||
%li{class: current_controller?(:issues, :milestones, :labels) ? 'active' : ''}
|
||||
= nav_link(controller: %w(issues milestones labels)) do
|
||||
= link_to project_issues_filter_path(@project) do
|
||||
Issues
|
||||
%span.count.issue_counter= @project.issues.opened.count
|
||||
|
||||
- if @project.repo_exists?
|
||||
- if @project.merge_requests_enabled
|
||||
%li{class: tab_class(:merge_requests)}
|
||||
= nav_link(controller: :merge_requests) do
|
||||
= link_to project_merge_requests_path(@project) do
|
||||
Merge Requests
|
||||
%span.count.merge_counter= @project.merge_requests.opened.count
|
||||
|
||||
- if @project.wall_enabled
|
||||
%li{class: tab_class(:wall)}
|
||||
= link_to wall_project_path(@project) do
|
||||
Wall
|
||||
= nav_link(path: 'projects#wall') do
|
||||
= link_to 'Wall', wall_project_path(@project)
|
||||
|
||||
- if @project.wiki_enabled
|
||||
%li{class: tab_class(:wiki)}
|
||||
= link_to project_wiki_path(@project, :index) do
|
||||
Wiki
|
||||
= nav_link(controller: :wikis) do
|
||||
= link_to 'Wiki', project_wiki_path(@project, :index)
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
= render "layouts/head_panel", title: "Admin area"
|
||||
.container
|
||||
%ul.main_menu
|
||||
%li.home{class: tab_class(:admin_root)}
|
||||
= nav_link(controller: :dashboard, html_options: {class: 'home'}) do
|
||||
= link_to "Stats", admin_root_path
|
||||
%li{class: tab_class(:admin_projects)}
|
||||
= nav_link(controller: :projects) do
|
||||
= link_to "Projects", admin_projects_path
|
||||
%li{class: tab_class(:admin_users)}
|
||||
= nav_link(controller: :users) do
|
||||
= link_to "Users", admin_users_path
|
||||
%li{class: tab_class(:admin_logs)}
|
||||
= nav_link(controller: :logs) do
|
||||
= link_to "Logs", admin_logs_path
|
||||
%li{class: tab_class(:admin_hooks)}
|
||||
= nav_link(controller: :hooks) do
|
||||
= link_to "Hooks", admin_hooks_path
|
||||
%li{class: tab_class(:admin_resque)}
|
||||
= nav_link(controller: :resque) do
|
||||
= link_to "Resque", admin_resque_path
|
||||
|
||||
.content= yield
|
||||
|
|
|
@ -6,23 +6,17 @@
|
|||
= render "layouts/head_panel", title: "Profile"
|
||||
.container
|
||||
%ul.main_menu
|
||||
%li.home{class: tab_class(:profile)}
|
||||
= nav_link(path: 'profile#show', html_options: {class: 'home'}) do
|
||||
= link_to "Profile", profile_path
|
||||
|
||||
%li{class: tab_class(:account)}
|
||||
= nav_link(path: 'profile#account') do
|
||||
= link_to "Account", profile_account_path
|
||||
|
||||
%li{class: tab_class(:ssh_keys)}
|
||||
= nav_link(controller: :keys) do
|
||||
= link_to keys_path do
|
||||
SSH Keys
|
||||
%span.count= current_user.keys.count
|
||||
|
||||
%li{class: tab_class(:design)}
|
||||
= nav_link(path: 'profile#design') do
|
||||
= link_to "Design", profile_design_path
|
||||
|
||||
%li{class: tab_class(:history)}
|
||||
= nav_link(path: 'profile#history') do
|
||||
= link_to "History", profile_history_path
|
||||
|
||||
|
||||
.content
|
||||
= yield
|
||||
.content= yield
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue