LP#1716486: fix hotkeys
authorGalen Charlton <gmc@equinoxinitiative.org>
Wed, 13 Sep 2017 19:35:39 +0000 (15:35 -0400)
committerKathy Lussier <klussier@masslnc.org>
Fri, 15 Sep 2017 11:15:44 +0000 (07:15 -0400)
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 <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/offline.js
Open-ILS/web/js/ui/default/staff/services/navbar.js

index 276333d..8c75f14 100644 (file)
@@ -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();
index bae8190..52c916f 100644 (file)
@@ -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)});
                     }
                 );
             }