[Bps-public-commit] rt-extension-ajaxpreviewscrips branch, master, updated. 338fd07ea0d99ac59afa4b85bc46529f9e9c97ec

? sunnavy sunnavy at bestpractical.com
Sat Jul 12 05:25:47 EDT 2014


The branch, master has been updated
       via  338fd07ea0d99ac59afa4b85bc46529f9e9c97ec (commit)
       via  ea7f09358ecf9f14cee460eb16d0b09e03d8b3a3 (commit)
      from  ca88c7e4d596cfc537b340d5bc1b4136e9215e2f (commit)

Summary of changes:
 META.yml                                      |  1 +
 html/Helpers/PreviewScrips                    |  4 +---
 html/Helpers/ShowSimplifiedRecipients         |  1 -
 html/Ticket/Elements/PreviewScrips            |  9 +++++++++
 html/Ticket/Elements/ShowSimplifiedRecipients | 11 +++++++++++
 lib/RT/Extension/AjaxPreviewScrips.pm         |  1 +
 static/css/ajaxpreviewscrips.css              |  8 ++++++++
 7 files changed, 31 insertions(+), 4 deletions(-)
 create mode 100644 static/css/ajaxpreviewscrips.css

- Log -----------------------------------------------------------------
commit ea7f09358ecf9f14cee460eb16d0b09e03d8b3a3
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 12 17:19:26 2014 +0800

    don't bother calling js if simplified recipients is not enabled

diff --git a/html/Ticket/Elements/ShowSimplifiedRecipients b/html/Ticket/Elements/ShowSimplifiedRecipients
index 3e159b6..3f902bd 100644
--- a/html/Ticket/Elements/ShowSimplifiedRecipients
+++ b/html/Ticket/Elements/ShowSimplifiedRecipients
@@ -48,6 +48,9 @@
 <%ARGS>
 $TicketObj
 </%ARGS>
+<%INIT>
+return unless RT->Config->Get('SimplifiedRecipients', $session{'CurrentUser'});
+</%INIT>
 <script type="text/javascript">
 jQuery( function() {
    jQuery('#ticket-update-metadata :input, input[name^=UpdateCc], input[name^=UpdateBcc]').change( function() {

commit 338fd07ea0d99ac59afa4b85bc46529f9e9c97ec
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 12 17:21:14 2014 +0800

    refactor "respect one-time Cc/Bcc"
    
    using radio is a bad idea, which is quite confusing and doesn't guarantee to
    be vertical aligned either.
    
    note that it's convenient to automatically update preview scrips when user
    selects autocomplete users, so we need to trigger the change on select.
    
    the css tweak is to make sure simplified recipients are vertical aligned,
    the normal preview scrips part doesn't have this issue.

diff --git a/META.yml b/META.yml
index 916d32b..12c1e57 100644
--- a/META.yml
+++ b/META.yml
@@ -18,6 +18,7 @@ no_index:
   directory:
     - html
     - inc
+    - static
 resources:
   license: http://opensource.org/licenses/gpl-license.php
 version: '0.01'
diff --git a/html/Helpers/PreviewScrips b/html/Helpers/PreviewScrips
index 7170e01..3ef3fce 100644
--- a/html/Helpers/PreviewScrips
+++ b/html/Helpers/PreviewScrips
@@ -101,9 +101,7 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
 %                 if ( $show_checkbox ) {
                       <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" />
 %                 }
-%                 else {
-                      <input type="radio" readonly="readonly" disabled="disabled" checked="checked" />
-%                 }
+
                   <label for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"><& /Elements/ShowUser, Address => $addr &></label>
 %                 $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
 %                 unless ( $show_checkbox ) {
diff --git a/html/Helpers/ShowSimplifiedRecipients b/html/Helpers/ShowSimplifiedRecipients
index a340a04..d336754 100644
--- a/html/Helpers/ShowSimplifiedRecipients
+++ b/html/Helpers/ShowSimplifiedRecipients
@@ -104,7 +104,6 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
 %         $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
 <br />
 %         if ( $no_squelch{$type}{$addr} ) {
-<input type="radio" readonly="readonly" disabled="disabled" checked="checked" />
 <label><& /Elements/ShowUser, Address => $addr &></label>
 %             if ( $type eq 'Cc' ) {
 (<&|/l&>explicit one-time Cc</&>)
diff --git a/html/Ticket/Elements/PreviewScrips b/html/Ticket/Elements/PreviewScrips
index 93bbdc4..d7e5aa1 100644
--- a/html/Ticket/Elements/PreviewScrips
+++ b/html/Ticket/Elements/PreviewScrips
@@ -61,5 +61,14 @@ jQuery( function() {
        );
    });
    jQuery('#UpdateType').change();
+
+   jQuery('input[name=UpdateCc], input[name=UpdateBcc]').each( function() {
+       var old_select = jQuery(this).autocomplete('option', 'select');
+       jQuery(this).autocomplete('option', 'select', function(event, ui) {
+           var ret = old_select.call(this, event, ui);
+           jQuery(this).change();
+           return ret;
+       });
+   });
 });
 </script>
diff --git a/html/Ticket/Elements/ShowSimplifiedRecipients b/html/Ticket/Elements/ShowSimplifiedRecipients
index 3f902bd..2e6093b 100644
--- a/html/Ticket/Elements/ShowSimplifiedRecipients
+++ b/html/Ticket/Elements/ShowSimplifiedRecipients
@@ -66,6 +66,14 @@ jQuery( function() {
    });
 % unless ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
    jQuery('#UpdateType').change();
+   jQuery('input[name=UpdateCc], input[name=UpdateBcc]').each( function() {
+       var old_select = jQuery(this).autocomplete('option', 'select');
+       jQuery(this).autocomplete('option', 'select', function(event, ui) {
+           var ret = old_select.call(this, event, ui);
+           jQuery(this).change();
+           return ret;
+       });
+   } );
 % }
 });
 </script>
diff --git a/lib/RT/Extension/AjaxPreviewScrips.pm b/lib/RT/Extension/AjaxPreviewScrips.pm
index 938c6a1..8a40d70 100644
--- a/lib/RT/Extension/AjaxPreviewScrips.pm
+++ b/lib/RT/Extension/AjaxPreviewScrips.pm
@@ -3,6 +3,7 @@ use warnings;
 package RT::Extension::AjaxPreviewScrips;
 
 our $VERSION = '0.01';
+RT->AddStyleSheets("ajaxpreviewscrips.css");
 
 =head1 NAME
 
diff --git a/static/css/ajaxpreviewscrips.css b/static/css/ajaxpreviewscrips.css
new file mode 100644
index 0000000..08e7e70
--- /dev/null
+++ b/static/css/ajaxpreviewscrips.css
@@ -0,0 +1,8 @@
+#recipients label {
+    padding-left: 2em;
+}
+
+#recipients input.checkbox {
+    position: absolute;
+    margin-left: 0.5em;
+}

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


More information about the Bps-public-commit mailing list