[Rt-commit] rt branch, 4.4/ticket-timer, updated. rt-4.2.11-189-g0b831f8

Shawn Moore shawn at bestpractical.com
Mon Sep 21 19:51:49 EDT 2015


The branch, 4.4/ticket-timer has been updated
       via  0b831f8f96c84bc433ffc88656662929c7f8fe21 (commit)
      from  c48baf170f35240a1123e1e77506a05d5430d11b (commit)

Summary of changes:
 share/html/Helpers/TicketTimer | 21 ++++++++++++++++++---
 share/static/css/base/misc.css | 17 +++++++++++++++++
 2 files changed, 35 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 0b831f8f96c84bc433ffc88656662929c7f8fe21
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Mon Sep 21 23:47:14 2015 +0000

    Redisplay readout (and error message) on network failures

diff --git a/share/html/Helpers/TicketTimer b/share/html/Helpers/TicketTimer
index 112a771..b38fe9d 100644
--- a/share/html/Helpers/TicketTimer
+++ b/share/html/Helpers/TicketTimer
@@ -121,9 +121,22 @@ jQuery( function() {
             seconds: Seconds
         };
 
-        jQuery.get(<% $submit_url |n,j %>, payload, function (data) {
-            readout.text(data);
-            jQuery('.control-line .close-popup').show().removeClass('hidden');
+        jQuery.ajax({
+            url: <% $submit_url |n,j %>,
+            data: payload,
+            success: function (data) {
+                readout.text(data);
+                jQuery('.control-line .close-popup').show().removeClass('hidden');
+            },
+            error: function (xhr, reason) {
+                renderReadout(Seconds);
+                jQuery('.ticket-timer').addClass('error');
+
+                // give the browser a chance to redraw the readout
+                setTimeout(function () {
+                    alert('Unable to submit time. Please add it to the ticket manually. The reason given was: ' + reason);
+                }, 100);
+            }
         });
 
         return false;
@@ -156,6 +169,8 @@ jQuery( function() {
     <div class="extra"><&|/l&>Time estimated</&>: <& /Ticket/Elements/ShowTime, minutes => $Ticket->TimeEstimated &></div>
 % }
 
+    <div class="on-error"><&|/l&>An error occurred while submitting time. Please submit your time manually.</&></div>
+
 </div>
 
 % $m->abort();
diff --git a/share/static/css/base/misc.css b/share/static/css/base/misc.css
index 0492b48..815b8ef 100644
--- a/share/static/css/base/misc.css
+++ b/share/static/css/base/misc.css
@@ -128,3 +128,20 @@ textarea.messagebox, #cke_Content, #cke_UpdateContent {
 .ticket-timer > div {
     margin-bottom: 0.4em;
 }
+
+.ticket-timer.error .readout {
+    color: red;
+}
+
+.ticket-timer.error .extra {
+    display: none;
+}
+
+.ticket-timer .on-error {
+    display: none;
+}
+
+.ticket-timer.error .on-error {
+    display: block;
+    color: red;
+}

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


More information about the rt-commit mailing list