Commit 0accbaae15926dbc1f8c17a315d58725e7fb7571
1 parent
80c34985
Exists in
master
and in
4 other branches
snippets restyle
Showing
5 changed files
with
53 additions
and
40 deletions
Show diff stats
app/assets/stylesheets/application.css
... | ... | @@ -34,6 +34,9 @@ |
34 | 34 | .width-65p{ |
35 | 35 | width:65%; |
36 | 36 | } |
37 | +.width-100p{ | |
38 | + width:100%; | |
39 | +} | |
37 | 40 | .append-bottom-10 { |
38 | 41 | margin-bottom:10px; |
39 | 42 | } |
... | ... | @@ -43,3 +46,6 @@ |
43 | 46 | .no-borders { |
44 | 47 | border:none; |
45 | 48 | } |
49 | +.no-padding { | |
50 | + padding:0 !important; | |
51 | +} | ... | ... |
app/assets/stylesheets/issues.css.scss
... | ... | @@ -59,7 +59,11 @@ |
59 | 59 | } |
60 | 60 | |
61 | 61 | body.project-page .issue-form-holder table.no-borders tr, |
62 | -body.project-page .issue-form-holder table.no-borders td | |
62 | +body.project-page .issue-form-holder table.no-borders td, | |
63 | +body.project-page .new_snippet table tr, | |
64 | +body.project-page .new_snippet table td, | |
65 | +body.project-page .edit_snippet table tr, | |
66 | +body.project-page .edit_snippet table td | |
63 | 67 | { |
64 | 68 | &:hover { |
65 | 69 | background:none; | ... | ... |
app/views/snippets/_form.html.haml
1 | 1 | %div |
2 | - = form_for [@project, @snippet] do |f| | |
3 | - -if @snippet.errors.any? | |
4 | - %ul | |
5 | - - @snippet.errors.full_messages.each do |msg| | |
6 | - %li= msg | |
2 | + .ui-box.width-100p | |
3 | + %h3 | |
4 | + = @snippet.new_record? ? "New snippet" : "Edit snippet ##{@snippet.id}" | |
5 | + = form_for [@project, @snippet] do |f| | |
6 | + .data.no-padding | |
7 | + %table.no-borders | |
8 | + -if @snippet.errors.any? | |
9 | + %tr | |
10 | + %td Errors | |
11 | + %td | |
12 | + #error_explanation | |
13 | + - @snippet.errors.full_messages.each do |msg| | |
14 | + %span= msg | |
15 | + %br | |
7 | 16 | |
8 | - %table.round-borders | |
9 | - %tr | |
10 | - %td= f.label :title | |
11 | - %td= f.text_field :title, :placeholder => "Example Snippet" | |
12 | - %tr | |
13 | - %td= f.label :file_name | |
14 | - %td= f.text_field :file_name, :placeholder => "example.rb" | |
15 | - %tr | |
16 | - %td= f.label "Lifetime" | |
17 | - %td= f.select :expires_at, lifetime_select_options | |
18 | - %tr | |
19 | - %td{:colspan => 2} | |
20 | - = f.label :content, "Code" | |
21 | - %br | |
22 | - %br | |
23 | - = f.text_area :content | |
17 | + %tr | |
18 | + %td= f.label :title | |
19 | + %td= f.text_field :title, :placeholder => "Example Snippet" | |
20 | + %tr | |
21 | + %td= f.label :file_name | |
22 | + %td= f.text_field :file_name, :placeholder => "example.rb" | |
23 | + %tr | |
24 | + %td= f.label "Lifetime" | |
25 | + %td= f.select :expires_at, lifetime_select_options | |
26 | + %tr | |
27 | + %td{:colspan => 2} | |
28 | + = f.label :content, "Code" | |
29 | + %br | |
30 | + %br | |
31 | + = f.text_area :content | |
24 | 32 | |
25 | - .actions.prepend-top | |
26 | - = f.submit 'Save', :class => "button" | |
33 | + .buttons | |
34 | + = f.submit 'Save', :class => "grey-button" | ... | ... |
app/views/snippets/index.html.haml
... | ... | @@ -2,9 +2,7 @@ |
2 | 2 | - if can? current_user, :write_snippet, @project |
3 | 3 | = link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10" |
4 | 4 | |
5 | - %table.round-borders#snippets-table | |
6 | - %thead | |
7 | - %th | |
5 | + %table#snippets-table | |
8 | 6 | = render @snippets.fresh |
9 | 7 | :javascript |
10 | 8 | $('.delete-snippet').live('ajax:success', function() { | ... | ... |
app/views/snippets/show.html.haml
1 | 1 | - if !@snippet.expired? |
2 | - %h2 | |
3 | - = "Snippet ##{@snippet.id} - #{@snippet.title}" | |
4 | - | |
5 | - .view_file | |
6 | - .view_file_header | |
7 | - %strong | |
8 | - = @snippet.file_name | |
9 | - %br/ | |
10 | - .view_file_content | |
2 | + .ui-box.width-100p | |
3 | + %h3 | |
4 | + = @snippet.title | |
5 | + .right= @snippet.file_name | |
6 | + .data.no-padding | |
11 | 7 | :erb |
12 | 8 | <%= raw @snippet.colorize %> |
13 | 9 | |
14 | - - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user | |
15 | - = link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "lbutton positive" | |
16 | - - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user | |
17 | - = link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" | |
10 | + .buttons | |
11 | + - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user | |
12 | + = link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "grey-button" | |
13 | + - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user | |
14 | + .right= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "grey-button delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" | |
18 | 15 | .clear |
19 | 16 | %br |
20 | 17 | .snippet_notes= render "notes/notes" | ... | ... |