snippets restyle

This commit is contained in:
Dmitriy Zaporozhets 2011-11-26 00:19:14 +02:00
parent 80c34985c8
commit 0accbaae15
5 changed files with 53 additions and 40 deletions

View file

@ -34,6 +34,9 @@
.width-65p{ .width-65p{
width:65%; width:65%;
} }
.width-100p{
width:100%;
}
.append-bottom-10 { .append-bottom-10 {
margin-bottom:10px; margin-bottom:10px;
} }
@ -43,3 +46,6 @@
.no-borders { .no-borders {
border:none; border:none;
} }
.no-padding {
padding:0 !important;
}

View file

@ -59,7 +59,11 @@
} }
body.project-page .issue-form-holder table.no-borders tr, 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 { &:hover {
background:none; background:none;

View file

@ -1,26 +1,34 @@
%div %div
= form_for [@project, @snippet] do |f| .ui-box.width-100p
-if @snippet.errors.any? %h3
%ul = @snippet.new_record? ? "New snippet" : "Edit snippet ##{@snippet.id}"
- @snippet.errors.full_messages.each do |msg| = form_for [@project, @snippet] do |f|
%li= msg .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
%tr %td= f.label :title
%td= f.label :title %td= f.text_field :title, :placeholder => "Example Snippet"
%td= f.text_field :title, :placeholder => "Example Snippet" %tr
%tr %td= f.label :file_name
%td= f.label :file_name %td= f.text_field :file_name, :placeholder => "example.rb"
%td= f.text_field :file_name, :placeholder => "example.rb" %tr
%tr %td= f.label "Lifetime"
%td= f.label "Lifetime" %td= f.select :expires_at, lifetime_select_options
%td= f.select :expires_at, lifetime_select_options %tr
%tr %td{:colspan => 2}
%td{:colspan => 2} = f.label :content, "Code"
= f.label :content, "Code" %br
%br %br
%br = f.text_area :content
= f.text_area :content
.actions.prepend-top .buttons
= f.submit 'Save', :class => "button" = f.submit 'Save', :class => "grey-button"

View file

@ -2,9 +2,7 @@
- if can? current_user, :write_snippet, @project - if can? current_user, :write_snippet, @project
= link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10" = link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10"
%table.round-borders#snippets-table %table#snippets-table
%thead
%th
= render @snippets.fresh = render @snippets.fresh
:javascript :javascript
$('.delete-snippet').live('ajax:success', function() { $('.delete-snippet').live('ajax:success', function() {

View file

@ -1,20 +1,17 @@
- if !@snippet.expired? - if !@snippet.expired?
%h2 .ui-box.width-100p
= "Snippet ##{@snippet.id} - #{@snippet.title}" %h3
= @snippet.title
.view_file .right= @snippet.file_name
.view_file_header .data.no-padding
%strong
= @snippet.file_name
%br/
.view_file_content
:erb :erb
<%= raw @snippet.colorize %> <%= raw @snippet.colorize %>
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user .buttons
= link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "lbutton positive" - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user = link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "grey-button"
= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" - 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 .clear
%br %br
.snippet_notes= render "notes/notes" .snippet_notes= render "notes/notes"