diff options
author | Mike Greiling <mike@pixelcog.com> | 2016-12-10 00:38:10 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2016-12-10 09:57:23 +0300 |
commit | 687872978100c168ce381448c0a9536fb53542ce (patch) | |
tree | 0703562ca713ca84098512a8ba166e2bfe023b8b /app/views/projects/snippets | |
parent | adbc37804e49e1d3ba02bf61122696e135666ff3 (diff) |
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.haml | 30 |
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) |