2011-10-09 00:36:38 +03:00
|
|
|
module ProjectsHelper
|
2011-10-11 23:00:00 +03:00
|
|
|
def view_mode_style(type)
|
|
|
|
cookies["project_view"] ||= "tile"
|
|
|
|
cookies["project_view"] == type ? nil : "display:none"
|
|
|
|
end
|
2011-10-18 14:33:30 +03:00
|
|
|
|
2011-10-18 17:44:43 +03:00
|
|
|
def load_note_parent(id, type, project)
|
2011-10-18 14:33:30 +03:00
|
|
|
case type
|
2011-10-18 17:44:43 +03:00
|
|
|
when "Issue" then @project.issues.find(id)
|
|
|
|
when "Commit" then @project.repo.commits(id).first
|
2011-10-19 20:41:14 +03:00
|
|
|
when "Snippet" then @project.snippets.find(id)
|
2011-10-18 14:33:30 +03:00
|
|
|
else
|
2011-10-18 17:44:43 +03:00
|
|
|
true
|
2011-10-18 14:33:30 +03:00
|
|
|
end
|
2011-10-26 18:46:25 +05:00
|
|
|
rescue
|
2011-10-18 17:44:43 +03:00
|
|
|
nil
|
2011-10-18 14:33:30 +03:00
|
|
|
end
|
2011-11-26 01:42:42 +02:00
|
|
|
|
2011-11-30 23:25:39 +02:00
|
|
|
# expires in 360 days
|
2011-11-26 01:42:42 +02:00
|
|
|
def switch_colorscheme_link(opts)
|
|
|
|
if cookies[:colorschema].blank?
|
2011-11-30 23:25:39 +02:00
|
|
|
link_to_function "paint it black!", "$.cookie('colorschema','black', {expires:360}); window.location.reload()", opts
|
2011-11-26 01:42:42 +02:00
|
|
|
else
|
2011-11-30 23:25:39 +02:00
|
|
|
link_to_function "paint it white!", "$.cookie('colorschema','', {expires:360}); window.location.reload()", opts
|
2011-11-26 01:42:42 +02:00
|
|
|
end
|
|
|
|
end
|
2011-10-09 00:36:38 +03:00
|
|
|
end
|