gitlab-org--gitlab-foss/app/views/snippets/_form.html.haml
2011-12-08 01:35:57 +02:00

36 lines
1.3 KiB
Text

%div
.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
%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
.buttons
= f.submit 'Save', :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}"