gitlab-org--gitlab-foss/app/helpers/snippets_helper.rb

21 lines
531 B
Ruby
Raw Normal View History

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?
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