]> source.dussan.org Git - redmine.git/commitdiff
Show warning when attempting to attach more than the allowed number of attachments...
authorGo MAEDA <maeda@farend.jp>
Thu, 26 Mar 2020 06:38:47 +0000 (06:38 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 26 Mar 2020 06:38:47 +0000 (06:38 +0000)
Patch by Mizuki ISHIKAWA.

git-svn-id: http://svn.redmine.org/redmine/trunk@19620 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/attachments/_form.html.erb
config/locales/en.yml
public/javascripts/attachments.js

index 96c8c6476d6e0fa600523e224b6de812a819fff4..6dd07a9d4369a3d7e5eb3de0881ef4014f8a7060 100644 (file)
@@ -30,6 +30,7 @@
         :multiple => multiple,
         :onchange => 'addInputFiles(this);',
         :data => {
+          :max_number_of_files_message => l(:error_attachments_too_many, :max_number_of_files => 10),
           :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,
index 2b4850c052c90125a263f22879cc66de8e0cc72d..efaea525202fd3160a9aaf7d7bb99f5975d1e367 100644 (file)
@@ -213,6 +213,7 @@ en:
   error_workflow_copy_target: 'Please select target tracker(s) and role(s)'
   error_unable_delete_issue_status: 'Unable to delete issue status (%{value})'
   error_unable_to_connect: "Unable to connect (%{value})"
+  error_attachments_too_many: "This file cannot be uploaded because it exceeds the maximum number of files that can be attached simultaneously (%{max_number_of_files})"
   error_attachment_too_big: "This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})"
   error_bulk_download_size_too_big: "These attachments cannot be bulk downloaded because the total file size exceeds the maximum allowed size (%{max_size})"
   error_session_expired: "Your session has expired. Please login again."
index 402cfa53fbec6b70609949167fe79b949f35354b..567b6be81b14fb9bb551c819b28c1b819a856f12 100644 (file)
@@ -29,6 +29,8 @@ 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;
 }