Redmine 3.4.4
This commit is contained in:
commit
64924a6376
2112 changed files with 259028 additions and 0 deletions
47
app/views/attachments/_form.html.erb
Normal file
47
app/views/attachments/_form.html.erb
Normal file
|
@ -0,0 +1,47 @@
|
|||
<% attachment_param ||= 'attachments' %>
|
||||
<% saved_attachments ||= container.saved_attachments if defined?(container) && container %>
|
||||
<% multiple = true unless defined?(multiple) && multiple == false %>
|
||||
<% show_add = multiple || saved_attachments.blank? %>
|
||||
<% description = (defined?(description) && description == false ? false : true) %>
|
||||
<% css_class = (defined?(filedrop) && filedrop == false ? '' : 'filedrop') %>
|
||||
|
||||
<span class="attachments_form">
|
||||
<span class="attachments_fields">
|
||||
<% if saved_attachments.present? %>
|
||||
<% saved_attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>">
|
||||
<%= text_field_tag("#{attachment_param}[p#{i}][filename]", attachment.filename, :class => 'filename') %>
|
||||
<% if attachment.container_id.present? %>
|
||||
<%= link_to l(:label_delete), "#", :onclick => "$(this).closest('.attachments_form').find('.add_attachment').show(); $(this).parent().remove(); return false;", :class => 'icon-only icon-del' %>
|
||||
<%= hidden_field_tag "#{attachment_param}[p#{i}][id]", attachment.id %>
|
||||
<% else %>
|
||||
<%= text_field_tag("#{attachment_param}[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description') if description %>
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'icon-only icon-del remove-upload') %>
|
||||
<%= hidden_field_tag "#{attachment_param}[p#{i}][token]", attachment.token %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<span class="add_attachment" style="<%= show_add ? nil : 'display:none;' %>">
|
||||
<%= file_field_tag "#{attachment_param}[dummy][file]",
|
||||
:id => nil,
|
||||
:class => "file_selector #{css_class}",
|
||||
:multiple => multiple,
|
||||
:onchange => 'addInputFiles(this);',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:upload_path => uploads_path(:format => 'js'),
|
||||
:param => attachment_param,
|
||||
:description => description,
|
||||
:description_placeholder => l(:label_optional_description)
|
||||
} %>
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<% end %>
|
45
app/views/attachments/_links.html.erb
Normal file
45
app/views/attachments/_links.html.erb
Normal file
|
@ -0,0 +1,45 @@
|
|||
<div class="attachments">
|
||||
<div class="contextual">
|
||||
<%= link_to(l(:label_edit_attachments),
|
||||
container_attachments_edit_path(container),
|
||||
:title => l(:label_edit_attachments),
|
||||
:class => 'icon-only icon-edit'
|
||||
) if options[:editable] %>
|
||||
</div>
|
||||
<table>
|
||||
<% for attachment in attachments %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= link_to_attachment attachment, class: 'icon icon-attachment' -%>
|
||||
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
<%= link_to_attachment attachment, class: 'icon-only icon-download', title: l(:button_download), download: true -%>
|
||||
</td>
|
||||
<td><%= attachment.description unless attachment.description.blank? %></td>
|
||||
<td>
|
||||
<% if options[:author] %>
|
||||
<span class="author"><%= attachment.author %>, <%= format_time(attachment.created_on) %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if options[:deletable] %>
|
||||
<%= link_to l(:button_delete), attachment_path(attachment),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:method => :delete,
|
||||
:class => 'delete icon-only icon-del',
|
||||
:title => l(:button_delete) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% if defined?(thumbnails) && thumbnails %>
|
||||
<% images = attachments.select(&:thumbnailable?) %>
|
||||
<% if images.any? %>
|
||||
<div class="thumbnails">
|
||||
<% images.each do |attachment| %>
|
||||
<div><%= thumbnail_tag(attachment) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
2
app/views/attachments/destroy.js.erb
Normal file
2
app/views/attachments/destroy.js.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
$('#attachments_<%= j params[:attachment_id] %>').closest('.attachments_form').find('.add_attachment').show();
|
||||
$('#attachments_<%= j params[:attachment_id] %>').remove();
|
10
app/views/attachments/diff.html.erb
Normal file
10
app/views/attachments/diff.html.erb
Normal file
|
@ -0,0 +1,10 @@
|
|||
<%= render :layout => 'layouts/file' do %>
|
||||
<%= form_tag({}, :method => 'get') do %>
|
||||
<p>
|
||||
<%= l(:label_view_diff) %>:
|
||||
<label><%= radio_button_tag 'type', 'inline', @diff_type != 'sbs', :onchange => "this.form.submit()" %> <%= l(:label_diff_inline) %></label>
|
||||
<label><%= radio_button_tag 'type', 'sbs', @diff_type == 'sbs', :onchange => "this.form.submit()" %> <%= l(:label_diff_side_by_side) %></label>
|
||||
</p>
|
||||
<% end %>
|
||||
<%= render :partial => 'common/diff', :locals => {:diff => @diff, :diff_type => @diff_type, :diff_style => nil} %>
|
||||
<% end %>
|
30
app/views/attachments/edit_all.html.erb
Normal file
30
app/views/attachments/edit_all.html.erb
Normal file
|
@ -0,0 +1,30 @@
|
|||
<h2><%= l(:label_edit_attachments) %></h2>
|
||||
|
||||
<%= error_messages_for *@attachments %>
|
||||
|
||||
<%= form_tag(container_attachments_path(@container), :method => 'patch') do %>
|
||||
<%= back_url_hidden_field_tag %>
|
||||
<div class="box attachments">
|
||||
<table>
|
||||
<% @attachments.each do |attachment| %>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<span class="icon icon-attachment"><%= attachment.filename_was %></span>
|
||||
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
<span class="author"><%= attachment.author %>, <%= format_time(attachment.created_on) %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="attachment-<%= attachment.id %>">
|
||||
<td><%= text_field_tag "attachments[#{attachment.id}][filename]", attachment.filename, :size => 40 %></td>
|
||||
<td>
|
||||
<%= text_field_tag "attachments[#{attachment.id}][description]", attachment.description, :size => 80, :placeholder => l(:label_optional_description) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
<p>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= link_to l(:button_cancel), back_url if back_url.present? %>
|
||||
</p>
|
||||
<% end %>
|
4
app/views/attachments/file.html.erb
Normal file
4
app/views/attachments/file.html.erb
Normal file
|
@ -0,0 +1,4 @@
|
|||
<%= render :layout => 'layouts/file' do %>
|
||||
|
||||
<%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %>
|
||||
<% end %>
|
3
app/views/attachments/image.html.erb
Normal file
3
app/views/attachments/image.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<%= render :layout => 'layouts/file' do %>
|
||||
<%= render :partial => 'common/image', :locals => {:path => download_named_attachment_path(@attachment, @attachment.filename), :alt => @attachment.filename} %>
|
||||
<% end %>
|
11
app/views/attachments/other.html.erb
Normal file
11
app/views/attachments/other.html.erb
Normal file
|
@ -0,0 +1,11 @@
|
|||
<%= render :layout => 'layouts/file' do %>
|
||||
<%= render :partial => 'common/other',
|
||||
:locals => {
|
||||
:download_link => link_to_attachment(
|
||||
@attachment,
|
||||
:text => l(:label_no_preview_download),
|
||||
:download => true,
|
||||
:class => 'icon icon-download'
|
||||
)
|
||||
} %>
|
||||
<% end %>
|
1
app/views/attachments/show.api.rsb
Normal file
1
app/views/attachments/show.api.rsb
Normal file
|
@ -0,0 +1 @@
|
|||
render_api_attachment(@attachment, api)
|
4
app/views/attachments/upload.api.rsb
Normal file
4
app/views/attachments/upload.api.rsb
Normal file
|
@ -0,0 +1,4 @@
|
|||
api.upload do
|
||||
api.id @attachment.id
|
||||
api.token @attachment.token
|
||||
end
|
14
app/views/attachments/upload.js.erb
Normal file
14
app/views/attachments/upload.js.erb
Normal file
|
@ -0,0 +1,14 @@
|
|||
var fileSpan = $('#attachments_<%= j params[:attachment_id] %>');
|
||||
<% if @attachment.new_record? %>
|
||||
fileSpan.hide();
|
||||
alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>");
|
||||
<% else %>
|
||||
fileSpan.find('input.token').val('<%= j @attachment.token %>');
|
||||
fileSpan.find('a.remove-upload')
|
||||
.attr({
|
||||
"data-remote": true,
|
||||
"data-method": 'delete',
|
||||
href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
|
||||
})
|
||||
.off('click');
|
||||
<% end %>
|
Loading…
Add table
Add a link
Reference in a new issue