Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@20712 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/4.2.0
<% attachment_param ||= 'attachments' %> | <% attachment_param ||= 'attachments' %> | ||||
<% attachment_format_custom_field ||= false %> | |||||
<% saved_attachments ||= container.saved_attachments if defined?(container) && container %> | <% saved_attachments ||= container.saved_attachments if defined?(container) && container %> | ||||
<% multiple = true unless defined?(multiple) && multiple == false %> | <% multiple = true unless defined?(multiple) && multiple == false %> | ||||
<% show_add = multiple || saved_attachments.blank? %> | <% show_add = multiple || saved_attachments.blank? %> | ||||
<% description = (defined?(description) && description == false ? false : true) %> | <% description = (defined?(description) && description == false ? false : true) %> | ||||
<% css_class = (defined?(filedrop) && filedrop == false ? '' : 'filedrop') %> | |||||
<% css_class = (defined?(filedrop) && filedrop == false ? '' : (attachment_format_custom_field ? 'custom-field-filedrop' : 'filedrop')) %> | |||||
<span class="attachments_form"> | <span class="attachments_form"> | ||||
<span class="attachments_fields"> | <span class="attachments_fields"> | ||||
:multiple => multiple, | :multiple => multiple, | ||||
:onchange => 'addInputFiles(this);', | :onchange => 'addInputFiles(this);', | ||||
:data => { | :data => { | ||||
:max_number_of_files_message => l(:error_attachments_too_many, :max_number_of_files => 10), | |||||
:max_number_of_files_message => l(:error_attachments_too_many, :max_number_of_files => (multiple ? 10 : 1)), | |||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes, | :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_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, | :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, |
:multiple => false, | :multiple => false, | ||||
:description => false, | :description => false, | ||||
:saved_attachments => [attachment].compact, | :saved_attachments => [attachment].compact, | ||||
:filedrop => false | |||||
:filedrop => true, | |||||
:attachment_format_custom_field => true | |||||
}) | }) | ||||
end | end | ||||
end | end |
if ($.inArray('Files', e.dataTransfer.types) > -1) { | if ($.inArray('Files', e.dataTransfer.types) > -1) { | ||||
handleFileDropEvent.target = e.target; | handleFileDropEvent.target = e.target; | ||||
uploadAndAttachFiles(e.dataTransfer.files, $('input:file.filedrop').first()); | |||||
if ($(this).hasClass('custom-field-filedroplistner')){ | |||||
uploadAndAttachFiles(e.dataTransfer.files, $(this).find('input:file.custom-field-filedrop').first()); | |||||
} else { | |||||
uploadAndAttachFiles(e.dataTransfer.files, $(this).find('input:file.filedrop').first()); | |||||
} | |||||
} | } | ||||
} | } | ||||
handleFileDropEvent.target = ''; | handleFileDropEvent.target = ''; | ||||
paste: copyImageFromClipboard | paste: copyImageFromClipboard | ||||
}).addClass('filedroplistner'); | }).addClass('filedroplistner'); | ||||
}); | }); | ||||
$('form div.box input:file.custom-field-filedrop').closest('p').not('.custom-field-filedroplistner').each(function() { | |||||
$(this).on({ | |||||
dragover: dragOverHandler, | |||||
dragleave: dragOutHandler, | |||||
drop: handleFileDropEvent | |||||
}).addClass('custom-field-filedroplistner'); | |||||
}); | |||||
} | } | ||||
} | } | ||||
a.remove-upload:hover {text-decoration:none !important;} | a.remove-upload:hover {text-decoration:none !important;} | ||||
.existing-attachment.deleted .filename {text-decoration:line-through; color:#999 !important;} | .existing-attachment.deleted .filename {text-decoration:line-through; color:#999 !important;} | ||||
div.fileover { background-color: lavender; } | |||||
div.fileover, p.custom-field-filedroplistner.fileover { background-color: lavender; } | |||||
div.attachments p { margin:4px 0 2px 0; } | div.attachments p { margin:4px 0 2px 0; } | ||||
div.attachments img { vertical-align: middle; } | div.attachments img { vertical-align: middle; } |