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
@@ -93,6 +93,12 @@ pre.well-pre { | @@ -93,6 +93,12 @@ pre.well-pre { | ||
93 | font-size: 12px; | 93 | font-size: 12px; |
94 | font-style: normal; | 94 | font-style: normal; |
95 | font-weight: normal; | 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 | /** Big Labels **/ | 104 | /** Big Labels **/ |
app/assets/stylesheets/gitlab_bootstrap/forms.scss
@@ -3,6 +3,16 @@ form { | @@ -3,6 +3,16 @@ form { | ||
3 | 3 | ||
4 | label { | 4 | label { |
5 | @extend .control-label; | 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,9 +13,20 @@ | ||
13 | = f.label :title | 13 | = f.label :title |
14 | .controls= f.text_field :title, placeholder: "Example Snippet", class: 'input-xlarge', required: true | 14 | .controls= f.text_field :title, placeholder: "Example Snippet", class: 'input-xlarge', required: true |
15 | .control-group | 15 | .control-group |
16 | - = f.label "Private?" | 16 | + = f.label "Access" |
17 | .controls | 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 | .control-group | 30 | .control-group |
20 | .file-editor | 31 | .file-editor |
21 | = f.label :file_name, "File" | 32 | = f.label :file_name, "File" |
@@ -33,9 +44,10 @@ | @@ -33,9 +44,10 @@ | ||
33 | - else | 44 | - else |
34 | = f.submit 'Save', class: "btn-save btn" | 45 | = f.submit 'Save', class: "btn-save btn" |
35 | 46 | ||
36 | - = link_to "Cancel", snippets_path(@project), class: "btn btn-cancel" | ||
37 | - unless @snippet.new_record? | 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 | :javascript | 53 | :javascript |
app/views/snippets/_snippet.html.haml
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | = link_to reliable_snippet_path(snippet) do | 3 | = link_to reliable_snippet_path(snippet) do |
4 | = truncate(snippet.title, length: 60) | 4 | = truncate(snippet.title, length: 60) |
5 | - if snippet.private? | 5 | - if snippet.private? |
6 | - %span.label.label-success | 6 | + %span.label.label-gray |
7 | %i.icon-lock | 7 | %i.icon-lock |
8 | private | 8 | private |
9 | %span.cgray.monospace.tiny.pull-right | 9 | %span.cgray.monospace.tiny.pull-right |
features/steps/snippets/snippets.rb
@@ -19,7 +19,7 @@ class SnippetsFeature < Spinach::FeatureSteps | @@ -19,7 +19,7 @@ class SnippetsFeature < Spinach::FeatureSteps | ||
19 | end | 19 | end |
20 | 20 | ||
21 | And 'I click link "Destroy"' do | 21 | And 'I click link "Destroy"' do |
22 | - click_link "Destroy" | 22 | + click_link "Remove" |
23 | end | 23 | end |
24 | 24 | ||
25 | And 'I submit new snippet "Personal snippet three"' do | 25 | And 'I submit new snippet "Personal snippet three"' do |
@@ -46,7 +46,7 @@ class SnippetsFeature < Spinach::FeatureSteps | @@ -46,7 +46,7 @@ class SnippetsFeature < Spinach::FeatureSteps | ||
46 | end | 46 | end |
47 | 47 | ||
48 | And 'I uncheck "Private" checkbox' do | 48 | And 'I uncheck "Private" checkbox' do |
49 | - find(:xpath, "//input[@id='personal_snippet_private']").set true | 49 | + choose "Public" |
50 | click_button "Save" | 50 | click_button "Save" |
51 | end | 51 | end |
52 | 52 |