2012-02-08 00:00:49 +01:00
|
|
|
%h3= @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}"
|
|
|
|
%hr
|
2011-12-15 07:12:24 +01:00
|
|
|
= form_for [@project, @snippet] do |f|
|
|
|
|
%table.no-borders
|
|
|
|
-if @snippet.errors.any?
|
2012-02-08 00:00:49 +01:00
|
|
|
.alert-message.block-message.error
|
|
|
|
%ul
|
|
|
|
- @snippet.errors.full_messages.each do |msg|
|
|
|
|
%li= msg
|
2011-10-26 15:46:25 +02:00
|
|
|
|
2012-02-08 00:00:49 +01:00
|
|
|
.clearfix
|
|
|
|
= f.label :title
|
2012-08-11 00:07:50 +02:00
|
|
|
.input= f.text_field :title, placeholder: "Example Snippet"
|
2012-02-08 00:00:49 +01:00
|
|
|
.clearfix
|
|
|
|
= f.label :file_name
|
2012-08-11 00:07:50 +02:00
|
|
|
.input= f.text_field :file_name, placeholder: "example.rb"
|
2012-02-08 00:00:49 +01:00
|
|
|
.clearfix
|
|
|
|
= f.label "Lifetime"
|
2012-09-10 08:09:55 +02:00
|
|
|
.input= f.select :expires_at, lifetime_select_options, {}, {class: 'chosen span2'}
|
2012-02-08 00:00:49 +01:00
|
|
|
.clearfix
|
|
|
|
= f.label :content, "Code"
|
2012-08-11 00:07:50 +02:00
|
|
|
.input= f.text_area :content, class: "span8"
|
2011-12-15 07:12:24 +01:00
|
|
|
|
2012-02-08 00:00:49 +01:00
|
|
|
.actions
|
2012-08-11 00:07:50 +02:00
|
|
|
= f.submit 'Save', class: "primary btn"
|
|
|
|
= link_to "Cancel", project_snippets_path(@project), class: " btn"
|
2011-12-15 07:12:24 +01:00
|
|
|
- unless @snippet.new_record?
|
2012-08-11 00:07:50 +02:00
|
|
|
.right= link_to 'Destroy', [@project, @snippet], confirm: 'Are you sure?', method: :delete, class: "btn right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}"
|