summaryrefslogtreecommitdiffstats
path: root/public/javascripts/attachments.js
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-01-13 06:30:49 +0000
committerGo MAEDA <maeda@farend.jp>2021-01-13 06:30:49 +0000
commitac015d49f9c6778420a9e5cac78ac44f5845a346 (patch)
tree2f198f9118cf7f1b672a333f2f207c274525de10 /public/javascripts/attachments.js
parentea08c3aa8174c04a75f9f64eb7dab21fcd728a8c (diff)
downloadredmine-ac015d49f9c6778420a9e5cac78ac44f5845a346.tar.gz
redmine-ac015d49f9c6778420a9e5cac78ac44f5845a346.zip
Drag and drop file upload to file type custom field (#30776).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@20712 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public/javascripts/attachments.js')
-rw-r--r--public/javascripts/attachments.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js
index 7e66939d6..63e72bac8 100644
--- a/public/javascripts/attachments.js
+++ b/public/javascripts/attachments.js
@@ -182,7 +182,11 @@ function handleFileDropEvent(e) {
if ($.inArray('Files', e.dataTransfer.types) > -1) {
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 = '';
@@ -211,6 +215,14 @@ function setupFileDrop() {
paste: copyImageFromClipboard
}).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');
+ });
}
}