2011-10-16 17:07:10 -04:00
|
|
|
module SnippetsHelper
|
2011-10-27 03:11:42 -04:00
|
|
|
def lifetime_select_options
|
2011-10-27 02:46:21 -04:00
|
|
|
options = [
|
|
|
|
['forever', nil],
|
2011-10-27 03:11:42 -04:00
|
|
|
['1 day', "#{Date.current + 1.day}"],
|
|
|
|
['1 week', "#{Date.current + 1.week}"],
|
|
|
|
['1 month', "#{Date.current + 1.month}"]
|
2011-10-27 02:46:21 -04:00
|
|
|
]
|
|
|
|
options_for_select(options)
|
|
|
|
end
|
2013-06-05 15:25:27 -04:00
|
|
|
|
|
|
|
def reliable_snippet_path(snippet)
|
|
|
|
if snippet.project_id?
|
2015-01-24 13:02:58 -05:00
|
|
|
namespace_project_snippet_path(snippet.project.namespace,
|
|
|
|
snippet.project, snippet)
|
2013-06-05 15:25:27 -04:00
|
|
|
else
|
|
|
|
snippet_path(snippet)
|
|
|
|
end
|
|
|
|
end
|
2011-10-16 17:07:10 -04:00
|
|
|
end
|