LP#1452950 Remove unsaved data warning after click-thru
authorBill Erickson <berickxx@gmail.com>
Sat, 16 Jan 2016 20:15:01 +0000 (15:15 -0500)
committerBill Erickson <berickxx@gmail.com>
Sat, 16 Jan 2016 20:16:26 +0000 (15:16 -0500)
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 <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/services/ui.js

index 34c6c4a..1a706b6 100644 (file)
@@ -199,6 +199,7 @@ function($window , egStrings) {
 
         // handle page change
         $($window).on('beforeunload', function() { 
+            service.clear();
             return msg || egStrings.EG_UNLOAD_PAGE_PROMPT_MSG;
         });
 
@@ -208,8 +209,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();
+            }
         });
     };