From: Bill Erickson Date: Sat, 16 Jan 2016 20:15:01 +0000 (-0500) Subject: LP#1452950 Remove unsaved data warning after click-thru X-Git-Tag: sprint4-merge-nov22~559 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4ee999b8f89d2a41cac194e94b827b3085b5d876;p=working%2FEvergreen.git LP#1452950 Remove unsaved data warning after click-thru Once the user clicks through the unsaved data warning, clear the warning for future navigation. If more fields are changed, the warning will be reinstated. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/web/js/ui/default/staff/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js index 2ffbc22931..7f8466691a 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -202,6 +202,7 @@ function($window , egStrings) { // handle page change $($window).on('beforeunload', function() { + service.clear(); return msg || egStrings.EG_UNLOAD_PAGE_PROMPT_MSG; }); @@ -211,8 +212,13 @@ function($window , egStrings) { // similar to the page-page prompt. service.locChangeCancel = $scope.$on('$locationChangeStart', function(evt, next, current) { - if (!confirm(msg || egStrings.EG_UNLOAD_CTRL_PROMPT_MSG)) + if (confirm(msg || egStrings.EG_UNLOAD_CTRL_PROMPT_MSG)) { + // user allowed the page to change. + // Clear the unload handler. + service.clear(); + } else { evt.preventDefault(); + } }); };