From 3d21fded8fa5089aafe9618c4092f70738677d69 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 16 Feb 2016 20:56:26 -0500 Subject: [PATCH] LP#1452950 re-attach unload warning after click-through Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js | 7 ++++--- Open-ILS/web/js/ui/default/staff/services/ui.js | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index 9385086d78..1d28a3bf27 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -695,10 +695,11 @@ function PatronRegCtrl($scope, $routeParams, $scope.edit_passthru.vis_level = 0; // TODO: add save/clone handlers here - var modify_tracked = false; $scope.field_modified = function() { - if (modify_tracked) return; - modify_tracked = true; + // Call attach with every field change, regardless of whether + // it's been called before. This will allow for re-attach after + // the user clicks through the unload warning. egUnloadPrompt + // will ensure we only attach once. egUnloadPrompt.attach($scope); } 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 7f8466691a..d9f77fa640 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -195,10 +195,12 @@ function($modal, $interpolate) { .factory('egUnloadPrompt', [ '$window','egStrings', function($window , egStrings) { - var service = {}; + var service = {attached : false}; // attach a page/scope unload prompt service.attach = function($scope, msg) { + if (service.attached) return; + service.attached = true; // handle page change $($window).on('beforeunload', function() { @@ -227,6 +229,7 @@ function($window , egStrings) { $($window).off('beforeunload'); if (service.locChangeCancel) service.locChangeCancel(); + service.attached = false; } return service; -- 2.43.2