From c06136c66b1a0f0ada8f5f2ef901344022fa6bbf Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Tue, 21 Mar 2017 10:22:59 -0400 Subject: [PATCH] webstaff: Allow multiple hotkeys for a single action Signed-off-by: Mike Rylander --- .../js/ui/default/staff/services/navbar.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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 ec00a9a738..d36d40e6c0 100644 --- a/Open-ILS/web/js/ui/default/staff/services/navbar.js +++ b/Open-ILS/web/js/ui/default/staff/services/navbar.js @@ -41,15 +41,17 @@ angular.module('egCoreMod') // adds a keyboard shortcut // http://chieffancypants.github.io/angular-hotkeys/ $scope.addHotkey = function(key, path, desc, elm) { - hotkeys.add({ - combo: key, - allowIn: ['INPUT','SELECT','TEXTAREA'], - description: desc, - callback: function(e) { - e.preventDefault(); - if (path) return navTo(path); - return $timeout(function(){$(elm).trigger('click')}); - } + angular.forEach(key.split(' '), function (k) { + hotkeys.add({ + combo: k, + allowIn: ['INPUT','SELECT','TEXTAREA'], + description: desc, + callback: function(e) { + e.preventDefault(); + if (path) return navTo(path); + return $timeout(function(){$(elm).trigger('click')}); + } + }); }); }; -- 2.43.2