Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/gitlab/snippets_helper.rb')
-rw-r--r--app/helpers/gitlab/snippets_helper.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/helpers/gitlab/snippets_helper.rb b/app/helpers/gitlab/snippets_helper.rb
new file mode 100644
index 00000000000..aaf4d43f852
--- /dev/null
+++ b/app/helpers/gitlab/snippets_helper.rb
@@ -0,0 +1,22 @@
+module Gitlab
+ module SnippetsHelper
+ def lifetime_select_options
+ options = [
+ ['forever', nil],
+ ['1 day', "#{Date.current + 1.day}"],
+ ['1 week', "#{Date.current + 1.week}"],
+ ['1 month', "#{Date.current + 1.month}"]
+ ]
+ options_for_select(options)
+ end
+
+ def reliable_snippet_path(snippet)
+ if snippet.project_id?
+ namespace_project_snippet_path(snippet.project.namespace,
+ snippet.project, snippet)
+ else
+ snippet_path(snippet)
+ end
+ end
+ end
+end