Commit adcc6a0b0e08158353627a8a900971aca07429bd

Authored by Robert Speicher
1 parent 60ac6a28

Move tab_class helper to TabHelper

app/helpers/application_helper.rb
@@ -99,45 +99,6 @@ module ApplicationHelper @@ -99,45 +99,6 @@ module ApplicationHelper
99 event.project.merge_requests_enabled 99 event.project.merge_requests_enabled
100 end 100 end
101 101
102 - def tab_class(tab_key)  
103 - active = case tab_key  
104 -  
105 - # Project Area  
106 - when :wall; wall_tab?  
107 - when :wiki; controller.controller_name == "wikis"  
108 - when :issues; issues_tab?  
109 - when :network; current_page?(controller: "projects", action: "graph", id: @project)  
110 - when :merge_requests; controller.controller_name == "merge_requests"  
111 -  
112 - # Dashboard Area  
113 - when :help; controller.controller_name == "help"  
114 - when :search; current_page?(search_path)  
115 - when :dash_issues; current_page?(dashboard_issues_path)  
116 - when :dash_mr; current_page?(dashboard_merge_requests_path)  
117 - when :root; current_page?(dashboard_path) || current_page?(root_path)  
118 -  
119 - # Profile Area  
120 - when :profile; current_page?(controller: "profile", action: :show)  
121 - when :history; current_page?(controller: "profile", action: :history)  
122 - when :account; current_page?(controller: "profile", action: :account)  
123 - when :token; current_page?(controller: "profile", action: :token)  
124 - when :design; current_page?(controller: "profile", action: :design)  
125 - when :ssh_keys; controller.controller_name == "keys"  
126 -  
127 - # Admin Area  
128 - when :admin_root; controller.controller_name == "dashboard"  
129 - when :admin_users; controller.controller_name == 'users'  
130 - when :admin_projects; controller.controller_name == "projects"  
131 - when :admin_hooks; controller.controller_name == 'hooks'  
132 - when :admin_resque; controller.controller_name == 'resque'  
133 - when :admin_logs; controller.controller_name == 'logs'  
134 -  
135 - else  
136 - false  
137 - end  
138 - active ? "current" : nil  
139 - end  
140 -  
141 def hexdigest(string) 102 def hexdigest(string)
142 Digest::SHA1.hexdigest string 103 Digest::SHA1.hexdigest string
143 end 104 end
app/helpers/tab_helper.rb
1 module TabHelper 1 module TabHelper
  2 + def tab_class(tab_key)
  3 + active = case tab_key
  4 +
  5 + # Project Area
  6 + when :wall; wall_tab?
  7 + when :wiki; controller.controller_name == "wikis"
  8 + when :issues; issues_tab?
  9 + when :network; current_page?(controller: "projects", action: "graph", id: @project)
  10 + when :merge_requests; controller.controller_name == "merge_requests"
  11 +
  12 + # Dashboard Area
  13 + when :help; controller.controller_name == "help"
  14 + when :search; current_page?(search_path)
  15 + when :dash_issues; current_page?(dashboard_issues_path)
  16 + when :dash_mr; current_page?(dashboard_merge_requests_path)
  17 + when :root; current_page?(dashboard_path) || current_page?(root_path)
  18 +
  19 + # Profile Area
  20 + when :profile; current_page?(controller: "profile", action: :show)
  21 + when :history; current_page?(controller: "profile", action: :history)
  22 + when :account; current_page?(controller: "profile", action: :account)
  23 + when :token; current_page?(controller: "profile", action: :token)
  24 + when :design; current_page?(controller: "profile", action: :design)
  25 + when :ssh_keys; controller.controller_name == "keys"
  26 +
  27 + # Admin Area
  28 + when :admin_root; controller.controller_name == "dashboard"
  29 + when :admin_users; controller.controller_name == 'users'
  30 + when :admin_projects; controller.controller_name == "projects"
  31 + when :admin_hooks; controller.controller_name == 'hooks'
  32 + when :admin_resque; controller.controller_name == 'resque'
  33 + when :admin_logs; controller.controller_name == 'logs'
  34 +
  35 + else
  36 + false
  37 + end
  38 + active ? "current" : nil
  39 + end
  40 +
2 def issues_tab? 41 def issues_tab?
3 controller.controller_name == "issues" || controller.controller_name == "milestones" 42 controller.controller_name == "issues" || controller.controller_name == "milestones"
4 end 43 end