2012-04-09 00:01:42 +02:00
|
|
|
module TabHelper
|
|
|
|
def issues_tab?
|
|
|
|
controller.controller_name == "issues" || controller.controller_name == "milestones"
|
|
|
|
end
|
|
|
|
|
|
|
|
def wall_tab?
|
2012-08-11 00:07:50 +02:00
|
|
|
current_page?(controller: "projects", action: "wall", id: @project)
|
2012-04-09 00:01:42 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def project_tab_class
|
2012-09-16 15:21:20 +02:00
|
|
|
[:show, :files, :edit, :update].each do |action|
|
2012-08-11 00:07:50 +02:00
|
|
|
return "current" if current_page?(controller: "projects", action: action, id: @project)
|
2012-04-09 00:01:42 +02:00
|
|
|
end
|
|
|
|
|
2012-06-03 02:58:49 +02:00
|
|
|
if ['snippets', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name
|
2012-04-09 00:01:42 +02:00
|
|
|
"current"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def tree_tab_class
|
2012-06-03 02:58:49 +02:00
|
|
|
controller.controller_name == "refs" ? "current" : nil
|
2012-04-09 00:01:42 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def commit_tab_class
|
2012-06-03 02:58:49 +02:00
|
|
|
if ['commits', 'repositories', 'protected_branches'].include? controller.controller_name
|
2012-04-09 00:01:42 +02:00
|
|
|
"current"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def branches_tab_class
|
|
|
|
if current_page?(branches_project_repository_path(@project)) ||
|
|
|
|
controller.controller_name == "protected_branches" ||
|
|
|
|
current_page?(project_repository_path(@project))
|
2012-06-03 02:58:49 +02:00
|
|
|
'active'
|
2012-04-09 00:01:42 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|