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:65%;
}
.width-100p{
width:100%;
}
.append-bottom-10 {
margin-bottom:10px;
}
@ -43,3 +46,6 @@
.no-borders {
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 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;

View file

@ -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"

View file

@ -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() {

View file

@ -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"