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

37 lines
1.3 KiB
Plaintext
Raw Normal View History

2011-10-16 23:07:10 +02:00
%div
2011-11-25 23:19:14 +01:00
.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
2011-10-16 23:07:10 +02:00
2011-11-25 23:19:14 +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
%tr
%td{:colspan => 2}
= f.label :content, "Code"
%br
%br
= f.text_area :content
2011-11-25 23:19:14 +01:00
.buttons
= f.submit 'Save', :class => "grey-button"
2011-12-08 00:35:57 +01:00
- 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}"