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>
Mon, 17 Apr 2017 19:11:40 +0000 (15:11 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/web/js/ui/default/staff/services/navbar.js

index ec00a9a..d36d40e 100644 (file)
@@ -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')});
+                            }
+                        });
                     });
                 };