|
1 |
<span id="attachments_fields">
|
| 1 |
2 |
<% if defined?(container) && container && container.saved_attachments %>
|
| 2 |
3 |
<% container.saved_attachments.each_with_index do |attachment, i| %>
|
| 3 |
|
<span class="icon icon-attachment" style="display:block; line-height:1.5em;">
|
| 4 |
|
<%= h(attachment.filename) %> (<%= number_to_human_size(attachment.filesize) %>)
|
| 5 |
|
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.id}.#{attachment.digest}" %>
|
|
4 |
<span id="attachments_p<%= i %>">
|
|
5 |
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename') +
|
|
6 |
text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description') +
|
|
7 |
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
|
8 |
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
| 6 |
9 |
</span>
|
| 7 |
10 |
<% end %>
|
| 8 |
11 |
<% end %>
|
| 9 |
|
<span id="attachments_fields">
|
| 10 |
|
<span>
|
| 11 |
|
<%= file_field_tag 'attachments[1][file]', :id => nil, :class => 'file',
|
| 12 |
|
:onchange => "checkFileSize(this, #{Setting.attachment_max_size.to_i.kilobytes}, '#{escape_javascript(l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)))}');" -%>
|
| 13 |
|
<nobr><%= text_field_tag 'attachments[1][description]', '', :id => nil, :class => 'description', :maxlength => 255, :placeholder => l(:label_optional_description) %>
|
| 14 |
|
<%= link_to_function(image_tag('delete.png'), 'removeFileField(this)', :title => (l(:button_delete))) %></nobr>
|
| 15 |
|
</span>
|
|
12 |
</span>
|
|
13 |
<span class="add_attachment">
|
|
14 |
<%= file_field_tag 'attachments[dummy][file]',
|
|
15 |
:id => nil,
|
|
16 |
:class => 'file_selector',
|
|
17 |
:multiple => true,
|
|
18 |
:onchange => 'addInputFiles(this);',
|
|
19 |
:data => {
|
|
20 |
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
|
21 |
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
|
22 |
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
|
23 |
:upload_path => uploads_path(:format => 'js'),
|
|
24 |
:description_placeholder => l(:label_optional_description)
|
|
25 |
} %>
|
|
26 |
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
| 16 |
27 |
</span>
|
| 17 |
28 |
|
| 18 |
|
<span class="add_attachment"><%= link_to l(:label_add_another_file), '#', :onclick => 'addFileField(); return false;', :class => 'add_attachment' %>
|
| 19 |
|
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</span>
|
|
29 |
<% content_for :header_tags do %>
|
|
30 |
<%= javascript_include_tag 'attachments' %>
|
|
31 |
<% end %>
|