mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
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
This commit is contained in:
parent
354d30df31
commit
ea08c3aa81
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user