Redmine 3.4.4

This commit is contained in:
Manuel Cillero 2018-02-02 22:19:29 +01:00
commit 64924a6376
2112 changed files with 259028 additions and 0 deletions

View 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('&nbsp;'.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 %>

View 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>

View file

@ -0,0 +1,2 @@
$('#attachments_<%= j params[:attachment_id] %>').closest('.attachments_form').find('.add_attachment').show();
$('#attachments_<%= j params[:attachment_id] %>').remove();

View 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 %>

View 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 %>

View file

@ -0,0 +1,4 @@
<%= render :layout => 'layouts/file' do %>
&nbsp;
<%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %>
<% end %>

View 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 %>

View 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 %>

View file

@ -0,0 +1 @@
render_api_attachment(@attachment, api)

View file

@ -0,0 +1,4 @@
api.upload do
api.id @attachment.id
api.token @attachment.token
end

View 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 %>