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-08 01:35:53 +0300
committerMike Greiling <mike@pixelcog.com>2016-12-10 09:57:23 +0300
commit54a1193d790ae40fea5db1d8596c12fbc7a93576 (patch)
tree98123332599e0d493a92901317f14ae8c5d6e672 /app/views/projects/snippets
parentb65d3e1132762b9e1a39ce908b3b481f92d9a10c (diff)
add scope filters to project snippets page
Diffstat (limited to 'app/views/projects/snippets')
-rw-r--r--app/views/projects/snippets/index.html.haml27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/views/projects/snippets/index.html.haml b/app/views/projects/snippets/index.html.haml
index e77e1b026f6..76792fb5326 100644
--- a/app/views/projects/snippets/index.html.haml
+++ b/app/views/projects/snippets/index.html.haml
@@ -1,5 +1,32 @@
- page_title "Snippets"
+- if current_user
+ .nav-links.snippet-scope-menu
+ %li{ class: ("active" unless params[:scope]) }
+ = link_to namespace_project_snippets_path(@project.namespace, @project) do
+ All
+ %span.badge
+ = @project.snippets.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
+
.sub-header-block
- if can?(current_user, :create_project_snippet, @project)
= link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new btn-wide-on-sm pull-right", title: "New snippet" do