[Rt-commit] rt branch, 4.4/attachment-warning-dropzone, created. rt-4.2.12-353-gf79d28e
Shawn Moore
shawn at bestpractical.com
Wed Oct 28 18:26:01 EDT 2015
The branch, 4.4/attachment-warning-dropzone has been created
at f79d28e90e05cca48253c351fca46a5eb1108723 (commit)
- Log -----------------------------------------------------------------
commit f79d28e90e05cca48253c351fca46a5eb1108723
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Wed Oct 28 22:25:23 2015 +0000
Fix attachment warning to work with dropzone
Fixes: I#31317
diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index d31352d..0cd2f2b 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -136,11 +136,15 @@ jQuery( function() {
jQuery('#attach-dropzone').removeClass('scaled');
});
attachDropzone.on('reset', function() {
- jQuery('#attach-dropzone').removeClass('scaled');
+ jQuery('#attach-dropzone').removeClass('scaled').removeClass('has-attachments');
+ jQuery('#attach-dropzone').triggerHandler('attachment-change');
});
var submit_input = jQuery('#attach-dropzone').closest('form').find('div.submit :submit:visible:last');
var submit_input_label = submit_input.attr('value');
attachDropzone.on('addedfile', function() {
+ jQuery('#attach-dropzone').addClass('has-attachments');
+ jQuery('#attach-dropzone').triggerHandler('attachment-change');
+
submit_input.prop('disabled', true).attr('value', <% loc('Uploading...') |n,j %>);
});
attachDropzone.on('queuecomplete', function() {
diff --git a/share/static/js/util.js b/share/static/js/util.js
index aec306f..2c33924 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -309,10 +309,9 @@ function ReplaceAllTextareas() {
function AddAttachmentWarning() {
var plainMessageBox = jQuery('.messagebox');
- var addFileField = jQuery('input[name=Attach]');
- var existingFileList = jQuery('tr.attachment input[type=checkbox]');
var warningMessage = jQuery('.messagebox-attachment-warning');
var ignoreMessage = warningMessage.find('.ignore');
+ var dropzoneElement = jQuery('#attach-dropzone');
// there won't be a ckeditor when using the plain <textarea>
var richTextEditor;
@@ -346,8 +345,7 @@ function AddAttachmentWarning() {
// if the word "attach" appears and there are no attachments in flight
var needsWarning = text &&
text.match(regex) &&
- !addFileField.val() &&
- existingFileList.filter(":not(:checked)").length == 0;
+ !dropzoneElement.hasClass('has-attachments');
if (needsWarning) {
warningMessage.show(instant ? 1 : 'fast');
@@ -409,11 +407,7 @@ function AddAttachmentWarning() {
});
}
- addFileField.bind('change', function () {
- toggleAttachmentWarning();
- });
-
- existingFileList.bind('change', function () {
+ dropzoneElement.on('attachment-change', function () {
toggleAttachmentWarning();
});
-----------------------------------------------------------------------
More information about the rt-commit
mailing list