gitlabhq/app/views/snippets/_form.html.haml

54 lines
1.5 KiB
Plaintext
Raw Normal View History

2011-12-15 07:12:24 +01:00
= form_for [@project, @snippet] do |f|
%div
%span.entity-info
- if @snippet.new_record?
= link_to project_snippets_path(@project) do
.entity-button
2012-01-21 22:17:29 +01:00
Snippets
2011-12-15 07:12:24 +01:00
%i
- else
= link_to project_snippet_path(@project, @snippet) do
.entity-button
2012-01-21 22:17:29 +01:00
Show Snippet
2011-12-15 07:12:24 +01:00
%i
%h2= @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}"
2011-10-16 23:07:10 +02:00
2011-12-15 07:12:24 +01:00
%hr
%table.no-borders
-if @snippet.errors.any?
%tr
%td{:colspan => 2}
#error_explanation
- @snippet.errors.full_messages.each do |msg|
%span= msg
2011-11-25 23:19:14 +01:00
%br
2011-12-15 07:12:24 +01:00
%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, {}, :style => "width:200px;"
%tr
%td{:colspan => 2}
= f.label :content, "Code"
%br
%br
= f.text_area :content
.merge-tabs
2012-01-21 22:17:29 +01:00
= f.submit 'Save', :class => "positive-button"
2011-12-15 07:12:24 +01:00
- unless @snippet.new_record?
.right= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "red-button delete-snippet", :id => "destroy_snippet_#{@snippet.id}"
:javascript
$(function(){
$('select#snippet_expires_at').chosen();
});