From 0accbaae15926dbc1f8c17a315d58725e7fb7571 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 26 Nov 2011 00:19:14 +0200 Subject: [PATCH] snippets restyle --- app/assets/stylesheets/application.css | 6 +++ app/assets/stylesheets/issues.css.scss | 6 ++- app/views/snippets/_form.html.haml | 54 +++++++++++++++----------- app/views/snippets/index.html.haml | 4 +- app/views/snippets/show.html.haml | 23 +++++------ 5 files changed, 53 insertions(+), 40 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 73dc9af7fee..47ec5f5a91f 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -34,6 +34,9 @@ .width-65p{ width:65%; } +.width-100p{ + width:100%; +} .append-bottom-10 { margin-bottom:10px; } @@ -43,3 +46,6 @@ .no-borders { border:none; } +.no-padding { + padding:0 !important; +} diff --git a/app/assets/stylesheets/issues.css.scss b/app/assets/stylesheets/issues.css.scss index a66c43dd9e3..a283a4566f7 100644 --- a/app/assets/stylesheets/issues.css.scss +++ b/app/assets/stylesheets/issues.css.scss @@ -59,7 +59,11 @@ } body.project-page .issue-form-holder table.no-borders tr, -body.project-page .issue-form-holder table.no-borders td +body.project-page .issue-form-holder table.no-borders td, +body.project-page .new_snippet table tr, +body.project-page .new_snippet table td, +body.project-page .edit_snippet table tr, +body.project-page .edit_snippet table td { &:hover { background:none; diff --git a/app/views/snippets/_form.html.haml b/app/views/snippets/_form.html.haml index b3cae65c3e9..77b0a96d91e 100644 --- a/app/views/snippets/_form.html.haml +++ b/app/views/snippets/_form.html.haml @@ -1,26 +1,34 @@ %div - = form_for [@project, @snippet] do |f| - -if @snippet.errors.any? - %ul - - @snippet.errors.full_messages.each do |msg| - %li= msg + .ui-box.width-100p + %h3 + = @snippet.new_record? ? "New snippet" : "Edit snippet ##{@snippet.id}" + = form_for [@project, @snippet] do |f| + .data.no-padding + %table.no-borders + -if @snippet.errors.any? + %tr + %td Errors + %td + #error_explanation + - @snippet.errors.full_messages.each do |msg| + %span= msg + %br - %table.round-borders - %tr - %td= f.label :title - %td= f.text_field :title, :placeholder => "Example Snippet" - %tr - %td= f.label :file_name - %td= f.text_field :file_name, :placeholder => "example.rb" - %tr - %td= f.label "Lifetime" - %td= f.select :expires_at, lifetime_select_options - %tr - %td{:colspan => 2} - = f.label :content, "Code" - %br - %br - = f.text_area :content + %tr + %td= f.label :title + %td= f.text_field :title, :placeholder => "Example Snippet" + %tr + %td= f.label :file_name + %td= f.text_field :file_name, :placeholder => "example.rb" + %tr + %td= f.label "Lifetime" + %td= f.select :expires_at, lifetime_select_options + %tr + %td{:colspan => 2} + = f.label :content, "Code" + %br + %br + = f.text_area :content - .actions.prepend-top - = f.submit 'Save', :class => "button" + .buttons + = f.submit 'Save', :class => "grey-button" diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index 691ec6408a8..f34a3617052 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -2,9 +2,7 @@ - if can? current_user, :write_snippet, @project = link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10" - %table.round-borders#snippets-table - %thead - %th + %table#snippets-table = render @snippets.fresh :javascript $('.delete-snippet').live('ajax:success', function() { diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index 757cdb11e03..9b379cf47bd 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -1,20 +1,17 @@ - if !@snippet.expired? - %h2 - = "Snippet ##{@snippet.id} - #{@snippet.title}" - - .view_file - .view_file_header - %strong - = @snippet.file_name - %br/ - .view_file_content + .ui-box.width-100p + %h3 + = @snippet.title + .right= @snippet.file_name + .data.no-padding :erb <%= raw @snippet.colorize %> - - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user - = link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "lbutton positive" - - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user - = link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" + .buttons + - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user + = link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "grey-button" + - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user + .right= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "grey-button delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" .clear %br .snippet_notes= render "notes/notes"