[Rt-commit] rt branch, master, updated. rt-4.2.12-497-g1acbaea

Shawn Moore shawn at bestpractical.com
Mon Nov 2 14:28:12 EST 2015


The branch, master has been updated
       via  1acbaeace86b3e66833698e04cf6df6578fb04ab (commit)
       via  7a121783b195f354c30b4324b09838db7866fe2e (commit)
      from  a7b79b7f671be4c921aba58077fae3b3c46999a2 (commit)

Summary of changes:
 share/html/Ticket/Elements/AddAttachments |  2 +-
 share/static/js/util.js                   | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 7a121783b195f354c30b4324b09838db7866fe2e
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..45b3948 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -313,6 +313,7 @@ function AddAttachmentWarning() {
     var ignoreMessage    = warningMessage.find('.ignore');
     var dropzoneElement  = jQuery('#attach-dropzone');
     var fallbackElement  = jQuery('.old-attach');
+    var reuseElements    = jQuery('#reuse-attachments');
 
     // there won't be a ckeditor when using the plain <textarea>
     var richTextEditor;
@@ -343,10 +344,16 @@ function AddAttachmentWarning() {
             text = plainMessageBox.val();
         }
 
+        // look for checked reuse attachment checkboxes
+        var has_reused_attachments = reuseElements
+                                        .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 +419,12 @@ function AddAttachmentWarning() {
         dropzoneElement.on('attachment-change', function () {
             toggleAttachmentWarning();
         });
+
+        reuseElements.on('change', 'input[type=checkbox]',
+            function () {
+                toggleAttachmentWarning();
+            }
+        );
     };
 
     // if dropzone has already tried and failed, don't show spurious warnings

commit 1acbaeace86b3e66833698e04cf6df6578fb04ab
Merge: a7b79b7 7a12178
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Mon Nov 2 14:28:08 2015 -0500

    Merge branch '4.4/reuse-attachments-warning'


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


More information about the rt-commit mailing list