Commit 8841eec426d7213de6cc381b0898be1a14e418e5
1 parent
6d125d47
Exists in
master
and in
4 other branches
Improve snippets UX
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
5 changed files
with
35 additions
and
7 deletions
Show diff stats
app/assets/stylesheets/gitlab_bootstrap/common.scss
app/assets/stylesheets/gitlab_bootstrap/forms.scss
app/views/snippets/_form.html.haml
| ... | ... | @@ -13,9 +13,20 @@ |
| 13 | 13 | = f.label :title |
| 14 | 14 | .controls= f.text_field :title, placeholder: "Example Snippet", class: 'input-xlarge', required: true |
| 15 | 15 | .control-group |
| 16 | - = f.label "Private?" | |
| 16 | + = f.label "Access" | |
| 17 | 17 | .controls |
| 18 | - = f.check_box :private, {class: ''} | |
| 18 | + = f.label :private_true, class: 'radio-label' do | |
| 19 | + = f.radio_button :private, true | |
| 20 | + %span | |
| 21 | + %strong Private | |
| 22 | + (only you can see this snippet) | |
| 23 | + %br | |
| 24 | + = f.label :private_false, class: 'radio-label' do | |
| 25 | + = f.radio_button :private, false | |
| 26 | + %span | |
| 27 | + %strong Public | |
| 28 | + (GitLab users can can see this snippet) | |
| 29 | + | |
| 19 | 30 | .control-group |
| 20 | 31 | .file-editor |
| 21 | 32 | = f.label :file_name, "File" |
| ... | ... | @@ -33,9 +44,10 @@ |
| 33 | 44 | - else |
| 34 | 45 | = f.submit 'Save', class: "btn-save btn" |
| 35 | 46 | |
| 36 | - = link_to "Cancel", snippets_path(@project), class: "btn btn-cancel" | |
| 37 | 47 | - unless @snippet.new_record? |
| 38 | - .pull-right= link_to 'Destroy', snippet_path(@snippet), confirm: 'Removed snippet cannot be restored! Are you sure?', method: :delete, class: "btn pull-right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}" | |
| 48 | + .pull-right.prepend-left-20 | |
| 49 | + = link_to 'Remove', snippet_path(@snippet), confirm: 'Removed snippet cannot be restored! Are you sure?', method: :delete, class: "btn btn-remove delete-snippet", id: "destroy_snippet_#{@snippet.id}" | |
| 50 | + = link_to "Cancel", snippets_path(@project), class: "btn btn-cancel" | |
| 39 | 51 | |
| 40 | 52 | |
| 41 | 53 | :javascript | ... | ... |
app/views/snippets/_snippet.html.haml
features/steps/snippets/snippets.rb
| ... | ... | @@ -19,7 +19,7 @@ class SnippetsFeature < Spinach::FeatureSteps |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | 21 | And 'I click link "Destroy"' do |
| 22 | - click_link "Destroy" | |
| 22 | + click_link "Remove" | |
| 23 | 23 | end |
| 24 | 24 | |
| 25 | 25 | And 'I submit new snippet "Personal snippet three"' do |
| ... | ... | @@ -46,7 +46,7 @@ class SnippetsFeature < Spinach::FeatureSteps |
| 46 | 46 | end |
| 47 | 47 | |
| 48 | 48 | And 'I uncheck "Private" checkbox' do |
| 49 | - find(:xpath, "//input[@id='personal_snippet_private']").set true | |
| 49 | + choose "Public" | |
| 50 | 50 | click_button "Save" |
| 51 | 51 | end |
| 52 | 52 | ... | ... |