2011-10-08 23:36:38 +02:00
|
|
|
module ProjectsHelper
|
2011-10-11 22:00:00 +02:00
|
|
|
def view_mode_style(type)
|
|
|
|
cookies["project_view"] ||= "tile"
|
|
|
|
cookies["project_view"] == type ? nil : "display:none"
|
|
|
|
end
|
2011-10-18 13:33:30 +02:00
|
|
|
|
2011-10-18 16:44:43 +02:00
|
|
|
def load_note_parent(id, type, project)
|
2011-10-18 13:33:30 +02:00
|
|
|
case type
|
2011-10-18 16:44:43 +02:00
|
|
|
when "Issue" then @project.issues.find(id)
|
|
|
|
when "Commit" then @project.repo.commits(id).first
|
2011-10-19 19:41:14 +02:00
|
|
|
when "Snippet" then @project.snippets.find(id)
|
2011-10-18 13:33:30 +02:00
|
|
|
else
|
2011-10-18 16:44:43 +02:00
|
|
|
true
|
2011-10-18 13:33:30 +02:00
|
|
|
end
|
2011-10-26 15:46:25 +02:00
|
|
|
rescue
|
2011-10-18 16:44:43 +02:00
|
|
|
nil
|
2011-10-18 13:33:30 +02:00
|
|
|
end
|
2011-11-26 00:42:42 +01:00
|
|
|
|
2011-12-30 20:56:34 +01:00
|
|
|
def project_tab_class
|
2012-02-08 00:00:49 +01:00
|
|
|
[:show, :files, :team, :edit, :update].each do |action|
|
2011-12-30 20:56:34 +01:00
|
|
|
return "current" if current_page?(:controller => "projects", :action => action, :id => @project)
|
|
|
|
end
|
|
|
|
|
|
|
|
if controller.controller_name == "snippets" ||
|
2012-02-20 07:39:03 +01:00
|
|
|
controller.controller_name == "hooks" ||
|
|
|
|
controller.controller_name == "deploy_keys" ||
|
2011-12-30 20:56:34 +01:00
|
|
|
controller.controller_name == "team_members"
|
|
|
|
"current"
|
2011-11-26 00:42:42 +01:00
|
|
|
end
|
|
|
|
end
|
2011-12-30 20:56:34 +01:00
|
|
|
|
|
|
|
def tree_tab_class
|
2012-01-11 08:35:21 +01:00
|
|
|
controller.controller_name == "refs" ?
|
|
|
|
"current" : nil
|
2011-12-30 20:56:34 +01:00
|
|
|
end
|
2011-12-30 21:56:13 +01:00
|
|
|
|
|
|
|
def repository_tab_class
|
2012-02-20 07:39:03 +01:00
|
|
|
#if controller.controller_name == "repositories" ||
|
|
|
|
#controller.controller_name == "hooks" ||
|
|
|
|
#controller.controller_name == "deploy_keys"
|
|
|
|
#"current"
|
|
|
|
#end
|
|
|
|
end
|
|
|
|
|
|
|
|
def commit_tab_class
|
|
|
|
if controller.controller_name == "commits" ||
|
|
|
|
controller.controller_name == "repositories" ||
|
|
|
|
controller.controller_name == "protected_branches"
|
|
|
|
"current"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def branches_tab_class
|
|
|
|
if current_page?(branches_project_repository_path(@project)) ||
|
2012-02-15 22:51:04 +01:00
|
|
|
controller.controller_name == "protected_branches" ||
|
2012-02-20 07:39:03 +01:00
|
|
|
current_page?(project_repository_path(@project))
|
|
|
|
'active'
|
2011-12-30 21:56:13 +01:00
|
|
|
end
|
|
|
|
end
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|