From a2982717e985b4625af40db6a05eeea869da08ad Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 15 May 2014 13:06:26 -0500 Subject: [PATCH] pjax: Restore unsaved changes warnings --- include/staff/tpl.inc.php | 2 +- scp/js/scp.js | 4 ++++ scp/js/ticket.js | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/staff/tpl.inc.php b/include/staff/tpl.inc.php index 4c518ba5d..fff7e85da 100644 --- a/include/staff/tpl.inc.php +++ b/include/staff/tpl.inc.php @@ -100,7 +100,7 @@ $tpl=$msgtemplates[$selected]; <div style="padding-bottom:3px;" class="faded"><strong>Email Subject and Body:</strong></div> <div id="toolbar"></div> -<div style="padding-top:5px;"> +<div id="save" style="padding-top:5px;"> <input type="text" name="subject" size="65" value="<?php echo $info['subject']; ?>" style="font-size:14pt;width:100%;box-sizing:border-box"> <div style="margin-bottom:0.5em;margin-top:0.5em"> diff --git a/scp/js/scp.js b/scp/js/scp.js index 6cc4dd1c1..d0833da54 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -639,12 +639,16 @@ $(document).on('pjax:click', function(options) { $.autoLock.releaseLock(); // Stop all animations $(document).stop(false, true); +}); + +$(document).on('pjax:start', function() { // Cancel save-changes warning banner $(document).unbind('pjax:beforeSend.changed'); $(window).unbind('beforeunload'); }); $(document).on('pjax:send', function(event) { + if ($('#loadingbar').length !== 0) { $('#loadingbar').remove(); } diff --git a/scp/js/ticket.js b/scp/js/ticket.js index 7e697f24a..e6f3f06e8 100644 --- a/scp/js/ticket.js +++ b/scp/js/ticket.js @@ -51,6 +51,9 @@ var autoLock = { } if(!autoLock.lasteventTime) { //I hate nav away warnings..but + $(document).on('pjax:beforeSend.changed', function(e) { + return confirm("Any changes or info you've entered will be discarded!"); + }); $(window).bind('beforeunload', function(e) { return "Any changes or info you've entered will be discarded!"; }); -- GitLab