Browse Source

HUE-1007 [oozie] Modal module captures escape key events

Closes modal by firing a click event on modal backdrop.
abec 13 years ago
parent
commit
c581d19020
1 changed files with 7 additions and 0 deletions
  1. 7 0
      apps/oozie/static/js/workflow.js

+ 7 - 0
apps/oozie/static/js/workflow.js

@@ -128,6 +128,13 @@ var ModalModule = function($, ko) {
     self.context = ko.observable();
     self.context = ko.observable();
     self.template = ko.observable(template || '');
     self.template = ko.observable(template || '');
     self.bound = false;
     self.bound = false;
+
+    // exit with escape key.
+    $(window).on('keyup', function(e) {
+      if (e.keyCode == 27) {
+        $('.modal-backdrop').click();
+      }
+    });
   };
   };
 
 
   module.prototype.show = function(context) {
   module.prototype.show = function(context) {