[Rt-commit] rt branch, 4.4/reuse-attachments-warning, created. rt-4.2.12-495-gb71f842

Dustin Graves dustin at bestpractical.com
Mon Nov 2 13:19:05 EST 2015


The branch, 4.4/reuse-attachments-warning has been created
        at  b71f842a37de1af234bc1db4f291b24949deeadd (commit)

- Log -----------------------------------------------------------------
commit b71f842a37de1af234bc1db4f291b24949deeadd
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Mon Nov 2 18:15:34 2015 +0000

    properly integrate no attachment warning with reuse attachment functionality

diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index caaa0f8..4502188 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -166,7 +166,7 @@ jQuery( function() {
 % if (@quoted_attachments) {
 <tr>
   <td class="label" valign="top"><&|/l&>Include attachments</&>:</td>
-  <td>
+  <td id="reuse-attachments">
 %     for my $attach (@quoted_attachments) {
     <label>
       <input type="checkbox" class="checkbox" name="AttachExisting" value="<% $attach->Id %>" \
diff --git a/share/static/js/util.js b/share/static/js/util.js
index 7b78234..d8899a7 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -343,10 +343,16 @@ function AddAttachmentWarning() {
             text = plainMessageBox.val();
         }
 
+        // look for checked reuse attachment checkboxes
+        var has_reused_attachments = jQuery('#reuse-attachments')
+                                        .find('input[type=checkbox]:checked')
+                                        .length;
+
         // if the word "attach" appears and there are no attachments in flight
         var needsWarning = text &&
                            text.match(regex) &&
-                           !dropzoneElement.hasClass('has-attachments');
+                           !dropzoneElement.hasClass('has-attachments') &&
+                           !has_reused_attachments;
 
         if (needsWarning) {
             warningMessage.show(instant ? 1 : 'fast');
@@ -412,6 +418,12 @@ function AddAttachmentWarning() {
         dropzoneElement.on('attachment-change', function () {
             toggleAttachmentWarning();
         });
+
+        jQuery('#reuse-attachments').on('change', 'input[type=checkbox]',
+            function () {
+                toggleAttachmentWarning();
+            }
+        );
     };
 
     // if dropzone has already tried and failed, don't show spurious warnings

-----------------------------------------------------------------------


More information about the rt-commit mailing list