summaryrefslogtreecommitdiff
path: root/app/views/projects/snippets
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2016-12-09 15:38:10 -0600
committerMike Greiling <mike@pixelcog.com>2016-12-10 00:57:23 -0600
commit687872978100c168ce381448c0a9536fb53542ce (patch)
tree0703562ca713ca84098512a8ba166e2bfe023b8b /app/views/projects/snippets
parentadbc37804e49e1d3ba02bf61122696e135666ff3 (diff)
downloadgitlab-ce-687872978100c168ce381448c0a9536fb53542ce.tar.gz
implement snippets_scope_menu partial to reduce code duplication
Diffstat (limited to 'app/views/projects/snippets')
-rw-r--r--app/views/projects/snippets/index.html.haml30
1 files changed, 2 insertions, 28 deletions
diff --git a/app/views/projects/snippets/index.html.haml b/app/views/projects/snippets/index.html.haml
index 978f4b87564..84e05cd6d88 100644
--- a/app/views/projects/snippets/index.html.haml
+++ b/app/views/projects/snippets/index.html.haml
@@ -2,34 +2,8 @@
- if current_user
.top-area
- .nav-links.snippet-scope-menu
- %li{ class: ("active" unless params[:scope]) }
- = link_to namespace_project_snippets_path(@project.namespace, @project) do
- All
- %span.badge
- - if @project.team.member?(current_user) || current_user.admin?
- = @project.snippets.count
- - else
- = @project.snippets.public_and_internal.count
-
- - if @project.team.member?(current_user) || current_user.admin?
- %li{ class: ("active" if params[:scope] == "are_private") }
- = link_to namespace_project_snippets_path(@project.namespace, @project, scope: 'are_private') do
- Private
- %span.badge
- = @project.snippets.are_private.count
-
- %li{ class: ("active" if params[:scope] == "are_internal") }
- = link_to namespace_project_snippets_path(@project.namespace, @project, scope: 'are_internal') do
- Internal
- %span.badge
- = @project.snippets.are_internal.count
-
- %li{ class: ("active" if params[:scope] == "are_public") }
- = link_to namespace_project_snippets_path(@project.namespace, @project, scope: 'are_public') do
- Public
- %span.badge
- = @project.snippets.are_public.count
+ - include_private = @project.team.member?(current_user) || current_user.admin?
+ = render partial: 'snippets/snippets_scope_menu', locals: { subject: @project, include_private: include_private }
.nav-controls.hidden-xs
- if can?(current_user, :create_project_snippet, @project)