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:
authorMike Greiling <mike@pixelcog.com>2016-12-10 00:38:10 +0300
committerMike Greiling <mike@pixelcog.com>2016-12-10 09:57:23 +0300
commit687872978100c168ce381448c0a9536fb53542ce (patch)
tree0703562ca713ca84098512a8ba166e2bfe023b8b /app/helpers/snippets_helper.rb
parentadbc37804e49e1d3ba02bf61122696e135666ff3 (diff)
implement snippets_scope_menu partial to reduce code duplication
Diffstat (limited to 'app/helpers/snippets_helper.rb')
-rw-r--r--app/helpers/snippets_helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/snippets_helper.rb b/app/helpers/snippets_helper.rb
index 7e33a562077..fc7febd3385 100644
--- a/app/helpers/snippets_helper.rb
+++ b/app/helpers/snippets_helper.rb
@@ -8,6 +8,17 @@ module SnippetsHelper
end
end
+ # Return the path of a snippets index for a user or for a project
+ #
+ # @returns String, path to snippet index
+ def snippets_path(subject = nil, opts = nil)
+ if subject.is_a?(Project)
+ namespace_project_snippets_path(subject.namespace, subject, opts)
+ else # assume subject === User
+ dashboard_snippets_path(opts)
+ end
+ end
+
# Get an array of line numbers surrounding a matching
# line, bounded by min/max.
#