diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 96c8c6476..51aad0161 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -30,6 +30,7 @@ :multiple => multiple, :onchange => 'addInputFiles(this);', :data => { + :max_number_of_files_message => l(:error_attachments_too_many), :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, diff --git a/config/locales/en.yml b/config/locales/en.yml index 7bb506c57..96711df83 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -214,6 +214,7 @@ en: error_unable_delete_issue_status: 'Unable to delete issue status (%{value})' error_unable_to_connect: "Unable to connect (%{value})" error_attachment_too_big: "This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})" + error_attachments_too_many: "This file cannot be uploaded because the maximum number of files that can be attached at the same time has been reached." error_session_expired: "Your session has expired. Please login again." error_token_expired: "This password recovery link has expired, please try again." warning_attachments_not_saved: "%{count} file(s) could not be saved." diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 402cfa53f..567b6be81 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -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; }