From bb85fcde6b95fb56dcf59c62f1c29a9aae2bb713 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 13 Sep 2017 15:35:39 -0400 Subject: [PATCH] LP#1716486: fix hotkeys This fixes a regression on the hotkeys introduced by the offline circulation module. To test ------- [1] Apply the patch and verify that hotkeys in the web staff client such as F1, F5, alt-s, and so forth work. [2] Go to offline circulation and verify that select hotkeys such as F1 and F2 activate corresponding tabs in the offline circulation page. [3] Repeat step 2 with the browser itself set to offline mode. Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- Open-ILS/web/js/ui/default/staff/offline.js | 2 +- Open-ILS/web/js/ui/default/staff/services/navbar.js | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/offline.js b/Open-ILS/web/js/ui/default/staff/offline.js index 276333d9f0..8c75f149d5 100644 --- a/Open-ILS/web/js/ui/default/staff/offline.js +++ b/Open-ILS/web/js/ui/default/staff/offline.js @@ -464,7 +464,7 @@ function($routeProvider , $locationProvider , $compileProvider) { } $rootScope.save_offline_xacts = function () { return $scope.save() }; - //$rootScope.active_tab = function (t) { $scope.active_tab = t }; + $rootScope.active_tab = function (t) { $scope.active_tab = t }; $scope.logout = function () { egCore.auth.logout(); diff --git a/Open-ILS/web/js/ui/default/staff/services/navbar.js b/Open-ILS/web/js/ui/default/staff/services/navbar.js index bae8190944..52c916fd60 100644 --- a/Open-ILS/web/js/ui/default/staff/services/navbar.js +++ b/Open-ILS/web/js/ui/default/staff/services/navbar.js @@ -32,14 +32,14 @@ angular.module('egCoreMod') description: desc, callback: function(e) { e.preventDefault(); - if (path) return navTo(path,route); + if (path) return navTo(path); return $timeout(function(){$(elm).trigger('click')}); } }); }); }; - function inspect(elm) { + function find_accesskeys(elm) { elm = angular.element(elm); if (elm.attr('eg-accesskey')) { $scope.addHotkey( @@ -49,9 +49,8 @@ angular.module('egCoreMod') elm ); } - angular.forEach(elm.children(), inspect); + angular.forEach(elm.children(), find_accesskeys); } - $timeout(function(){inspect($element)}); $scope.retrieveLastRecord = function() { var last_record = egCore.hatch.getLocalItem("eg.cat.last_record_retrieved"); @@ -117,6 +116,10 @@ angular.module('egCoreMod') $scope.showRecentPatrons = val > 1; }); } + // need to defer initialization of hotkeys to this point + // as some of them are conditional on whether one is logged in + // or is working in offline circulation mode + $timeout(function(){find_accesskeys($element)}); } ); } -- 2.43.2