2012-02-07 18:00:49 -05:00
|
|
|
%h3= @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}"
|
|
|
|
%hr
|
2011-12-15 01:12:24 -05:00
|
|
|
= form_for [@project, @snippet] do |f|
|
|
|
|
%table.no-borders
|
|
|
|
-if @snippet.errors.any?
|
2012-02-07 18:00:49 -05:00
|
|
|
.alert-message.block-message.error
|
|
|
|
%ul
|
|
|
|
- @snippet.errors.full_messages.each do |msg|
|
|
|
|
%li= msg
|
2011-10-26 09:46:25 -04:00
|
|
|
|
2012-02-07 18:00:49 -05:00
|
|
|
.clearfix
|
|
|
|
= f.label :title
|
|
|
|
.input= f.text_field :title, :placeholder => "Example Snippet"
|
|
|
|
.clearfix
|
|
|
|
= f.label :file_name
|
|
|
|
.input= f.text_field :file_name, :placeholder => "example.rb"
|
|
|
|
.clearfix
|
|
|
|
= f.label "Lifetime"
|
|
|
|
.input= f.select :expires_at, lifetime_select_options, {}, :style => "width:200px;"
|
|
|
|
.clearfix
|
|
|
|
= f.label :content, "Code"
|
2012-05-17 17:23:18 -04:00
|
|
|
.input= f.text_area :content, :class => "span8"
|
2011-12-15 01:12:24 -05:00
|
|
|
|
2012-02-07 18:00:49 -05:00
|
|
|
.actions
|
|
|
|
= f.submit 'Save', :class => "primary btn"
|
|
|
|
= link_to "Cancel", project_snippets_path(@project), :class => " btn"
|
2011-12-15 01:12:24 -05:00
|
|
|
- unless @snippet.new_record?
|
2012-02-07 18:00:49 -05:00
|
|
|
.right= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "btn right danger delete-snippet", :id => "destroy_snippet_#{@snippet.id}"
|
2011-12-15 01:12:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-03 18:37:27 -04:00
|
|
|
:javascript
|
|
|
|
$(function(){
|
2011-12-15 01:12:24 -05:00
|
|
|
$('select#snippet_expires_at').chosen();
|
|
|
|
});
|
|
|
|
|