summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2014-10-08 16:44:25 +0300
committerValery Sizov <valery@gitlab.com>2014-10-09 17:09:53 +0300
commit47f539f5a6a930b2cfd4f9834b4d1bd5e1c180cb (patch)
tree0b528d431aa1625d92d3598f6a86ef8aa93b6491 /app/views
parentf7dc15c6bdb75a5f611c389ece3fe251f94a2d8f (diff)
downloadgitlab-ce-47f539f5a6a930b2cfd4f9834b4d1bd5e1c180cb.tar.gz
Snippets: public/internal/private
Diffstat (limited to 'app/views')
-rw-r--r--app/views/shared/snippets/_form.html.haml18
-rw-r--r--app/views/shared/snippets/_visibility_level.html.haml27
-rw-r--r--app/views/snippets/current_user_index.html.haml5
-rw-r--r--app/views/snippets/index.html.haml10
-rw-r--r--app/views/snippets/user_index.html.haml5
5 files changed, 43 insertions, 22 deletions
diff --git a/app/views/shared/snippets/_form.html.haml b/app/views/shared/snippets/_form.html.haml
index f4d74045f77..f729f129e45 100644
--- a/app/views/shared/snippets/_form.html.haml
+++ b/app/views/shared/snippets/_form.html.haml
@@ -10,22 +10,8 @@
= f.label :title, class: 'control-label'
.col-sm-10= f.text_field :title, placeholder: "Example Snippet", class: 'form-control', required: true
- - unless @snippet.respond_to?(:project)
- .form-group
- = f.label "Access", class: 'control-label'
- .col-sm-10
- = f.label :private_true, class: 'radio-label' do
- = f.radio_button :private, true
- %span
- %strong Private
- (only you can see this snippet)
- %br
- = f.label :private_false, class: 'radio-label' do
- = f.radio_button :private, false
- %span
- %strong Internal
- (GitLab users can see this snippet)
-
+ = render "shared/snippets/visibility_level", f: f, visibility_level: gitlab_config.default_projects_features.visibility_level, can_change_visibility_level: true
+
.form-group
.file-editor
= f.label :file_name, "File", class: 'control-label'
diff --git a/app/views/shared/snippets/_visibility_level.html.haml b/app/views/shared/snippets/_visibility_level.html.haml
new file mode 100644
index 00000000000..9acff18e450
--- /dev/null
+++ b/app/views/shared/snippets/_visibility_level.html.haml
@@ -0,0 +1,27 @@
+.form-group.project-visibility-level-holder
+ = f.label :visibility_level, class: 'control-label' do
+ Visibility Level
+ = link_to "(?)", help_page_path("public_access", "public_access")
+ .col-sm-10
+ - if can_change_visibility_level
+ - Gitlab::VisibilityLevel.values.each do |level|
+ .radio
+ - restricted = restricted_visibility_levels.include?(level)
+ = f.radio_button :visibility_level, level, disabled: restricted
+ = label "#{dom_class(@snippet)}_visibility_level", level do
+ = visibility_level_icon(level)
+ .option-title
+ = visibility_level_label(level)
+ .option-descr
+ = snippet_visibility_level_description(level)
+ - unless restricted_visibility_levels.empty?
+ .col-sm-10
+ %span.info
+ Some visibility level settings have been restricted by the administrator.
+ - else
+ .col-sm-10
+ %span.info
+ = visibility_level_icon(visibility_level)
+ %strong
+ = visibility_level_label(visibility_level)
+ .light= visibility_level_description(visibility_level)
diff --git a/app/views/snippets/current_user_index.html.haml b/app/views/snippets/current_user_index.html.haml
index 14b5b072ec2..b2b7ea4df0e 100644
--- a/app/views/snippets/current_user_index.html.haml
+++ b/app/views/snippets/current_user_index.html.haml
@@ -28,6 +28,11 @@
Internal
%span.pull-right
= @user.snippets.are_internal.count
+ = nav_tab :scope, 'are_public' do
+ = link_to user_snippets_path(@user, scope: 'are_public') do
+ Public
+ %span.pull-right
+ = @user.snippets.are_public.count
.col-md-9.my-snippets
= render 'snippets'
diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml
index cea2517a8e1..0d71c41e2e7 100644
--- a/app/views/snippets/index.html.haml
+++ b/app/views/snippets/index.html.haml
@@ -2,10 +2,12 @@
Public snippets
.pull-right
- = link_to new_snippet_path, class: "btn btn-new btn-grouped", title: "New Snippet" do
- Add new snippet
- = link_to user_snippets_path(current_user), class: "btn btn-grouped" do
- My snippets
+
+ - if current_user
+ = link_to new_snippet_path, class: "btn btn-new btn-grouped", title: "New Snippet" do
+ Add new snippet
+ = link_to user_snippets_path(current_user), class: "btn btn-grouped" do
+ My snippets
%p.light
Public snippets created by you and other users are listed here
diff --git a/app/views/snippets/user_index.html.haml b/app/views/snippets/user_index.html.haml
index 1cb53ec6a25..67f3a68aa22 100644
--- a/app/views/snippets/user_index.html.haml
+++ b/app/views/snippets/user_index.html.haml
@@ -4,8 +4,9 @@
%span
\/
Snippets
- = link_to new_snippet_path, class: "btn btn-small add_new pull-right", title: "New Snippet" do
- Add new snippet
+ - if current_user
+ = link_to new_snippet_path, class: "btn btn-small add_new pull-right", title: "New Snippet" do
+ Add new snippet
%hr