<% projects = Project.visible.order(:name) %> <%= error_messages_for('advertisement') %>

<%= label_tag('advertisement[heading]', (l(:label_heading) + ' ' + content_tag(:span, '*', :class => 'required')).html_safe) %> <%= text_field_tag('advertisement[heading]', @advertisement ? h(@advertisement.heading) : nil, :size => 60) %>

<%= label_tag('attachments[1][file]', l(:label_image)) %> <% if @advertisement && @advertisement.attachments.any? %> <% attachment = @advertisement.attachments.first %> <%= link_to_attachment(attachment, :class => 'icon icon-attachment') %> (<%= number_to_human_size(attachment.filesize) %>) <%= link_to(image_tag('delete.png'), { :controller => 'advertisements', :action => 'destroy_attachment', :id => attachment }, :confirm => l(:text_are_you_sure), :method => :delete, :class => 'delete', :title => l(:button_delete)) %> <%= attachment.author %>, <%= format_time(attachment.created_on) %> <% else %> <%= file_field_tag('attachments[1][file]', :size => 60) %>
<%= content_tag(:em, l(:label_images_only) + ', ' + l(:label_correct_dimension) + ', ' + l(:label_max_size) + ': ' + number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)) %> <% end %>

<%= label_tag('advertisement[content]', (l(:label_content) + ' ' + content_tag(:span, '*', :class => 'required')).html_safe) %> <%= text_area_tag('advertisement[content]', @advertisement ? @advertisement.content : nil, :cols => 60, :rows => 7, :class => 'wiki-edit') %>

<%= label_tag('advertisement[language]', (l(:field_language) + ' ' + content_tag(:span, '*', :class => 'required')).html_safe) %> <%= select_tag('advertisement[language]', options_for_select(lang_options_for_select(false), @advertisement ? @advertisement.language : current_language.to_s)) %>

<%= label_tag('advertisement[enabled]', l(:label_enabled)) %> <%= hidden_field_tag('advertisement[enabled]', 0) %> <%= check_box_tag('advertisement[enabled]', 1, @advertisement ? @advertisement.enabled? : true) %>

<%= wikitoolbar_for('advertisement_content') %>