Commit 8841eec426d7213de6cc381b0898be1a14e418e5

Authored by Dmitriy Zaporozhets
1 parent 6d125d47

Improve snippets UX

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/assets/stylesheets/gitlab_bootstrap/common.scss
... ... @@ -93,6 +93,12 @@ pre.well-pre {
93 93 font-size: 12px;
94 94 font-style: normal;
95 95 font-weight: normal;
  96 +
  97 + &.label-gray {
  98 + background-color: #eee;
  99 + color: #999;
  100 + text-shadow: none;
  101 + }
96 102 }
97 103  
98 104 /** Big Labels **/
... ...
app/assets/stylesheets/gitlab_bootstrap/forms.scss
... ... @@ -3,6 +3,16 @@ form {
3 3  
4 4 label {
5 5 @extend .control-label;
  6 +
  7 + &.radio-label {
  8 + text-align: left;
  9 + width: 100%;
  10 + margin-left: 0;
  11 +
  12 + input[type="radio"] {
  13 + margin-top: 1px !important;
  14 + }
  15 + }
6 16 }
7 17 }
8 18  
... ...
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
... ... @@ -3,7 +3,7 @@
3 3 = link_to reliable_snippet_path(snippet) do
4 4 = truncate(snippet.title, length: 60)
5 5 - if snippet.private?
6   - %span.label.label-success
  6 + %span.label.label-gray
7 7 %i.icon-lock
8 8 private
9 9 %span.cgray.monospace.tiny.pull-right
... ...
features/steps/snippets/snippets.rb
... ... @@ -19,7 +19,7 @@ class SnippetsFeature &lt; 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 &lt; 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  
... ...