Commit 0accbaae15926dbc1f8c17a315d58725e7fb7571

Authored by Dmitriy Zaporozhets
1 parent 80c34985

snippets restyle

app/assets/stylesheets/application.css
@@ -34,6 +34,9 @@ @@ -34,6 +34,9 @@
34 .width-65p{ 34 .width-65p{
35 width:65%; 35 width:65%;
36 } 36 }
  37 +.width-100p{
  38 + width:100%;
  39 +}
37 .append-bottom-10 { 40 .append-bottom-10 {
38 margin-bottom:10px; 41 margin-bottom:10px;
39 } 42 }
@@ -43,3 +46,6 @@ @@ -43,3 +46,6 @@
43 .no-borders { 46 .no-borders {
44 border:none; 47 border:none;
45 } 48 }
  49 +.no-padding {
  50 + padding:0 !important;
  51 +}
app/assets/stylesheets/issues.css.scss
@@ -59,7 +59,11 @@ @@ -59,7 +59,11 @@
59 } 59 }
60 60
61 body.project-page .issue-form-holder table.no-borders tr, 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 &:hover { 68 &:hover {
65 background:none; 69 background:none;
app/views/snippets/_form.html.haml
1 %div 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,9 +2,7 @@
2 - if can? current_user, :write_snippet, @project 2 - if can? current_user, :write_snippet, @project
3 = link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10" 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 = render @snippets.fresh 6 = render @snippets.fresh
9 :javascript 7 :javascript
10 $('.delete-snippet').live('ajax:success', function() { 8 $('.delete-snippet').live('ajax:success', function() {
app/views/snippets/show.html.haml
1 - if !@snippet.expired? 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 :erb 7 :erb
12 <%= raw @snippet.colorize %> 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 .clear 15 .clear
19 %br 16 %br
20 .snippet_notes= render "notes/notes" 17 .snippet_notes= render "notes/notes"