gitlabhq/app/helpers/projects_helper.rb

19 lines
419 B
Ruby
Raw Normal View History

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
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
rescue
2011-10-18 16:44:43 +02:00
nil
2011-10-18 13:33:30 +02:00
end
2011-10-08 23:36:38 +02:00
end