webstaff: Allow multiple hotkeys for a single action
authorMike Rylander <mrylander@gmail.com>
Tue, 21 Mar 2017 14:22:59 +0000 (10:22 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 30 Mar 2017 16:48:19 +0000 (12:48 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/web/js/ui/default/staff/services/navbar.js

index ccb7d4d..25724f3 100644 (file)
@@ -39,15 +39,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')});
+                            }
+                        });
                     });
                 };