summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-01-13 06:12:14 +0000
committerGo MAEDA <maeda@farend.jp>2021-01-13 06:12:14 +0000
commitea08c3aa8174c04a75f9f64eb7dab21fcd728a8c (patch)
tree9608222ee9a73ff86de9f826efedce514d67004b /public
parent354d30df31bbc783aa512ce603ee53d604b0c64d (diff)
downloadredmine-ea08c3aa8174c04a75f9f64eb7dab21fcd728a8c.tar.gz
redmine-ea08c3aa8174c04a75f9f64eb7dab21fcd728a8c.zip
Fix that alerts may be displayed multiple times when the number of files attempting to be uploaded exceeds the limit (#18555).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@20711 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public')
-rw-r--r--public/javascripts/attachments.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js
index 76203455e..7e66939d6 100644
--- a/public/javascripts/attachments.js
+++ b/public/javascripts/attachments.js
@@ -29,8 +29,6 @@ function addFile(inputEl, file, eagerUpload) {
addAttachment.toggle(attachmentsFields.children().length < maxFiles);
return attachmentId;
- } else {
- alert($('input.file_selector').data('max-number-of-files-message'));
}
return null;
}
@@ -161,6 +159,7 @@ function uploadAndAttachFiles(files, inputEl) {
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
var sizeExceeded = false;
+ var filesLength = $(inputEl).closest('.attachments_form').find('.attachments_fields').children().length + files.length
$.each(files, function() {
if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
});
@@ -169,6 +168,10 @@ function uploadAndAttachFiles(files, inputEl) {
} else {
$.each(files, function() {addFile(inputEl, this, true);});
}
+
+ if (filesLength > ($(inputEl).attr('multiple') == 'multiple' ? 10 : 1)) {
+ window.alert($(inputEl).data('max-number-of-files-message'));
+ }
return sizeExceeded;
}