Allow escaping out of CourseOutlineXBlockModals

This commit is contained in:
Tyler Hallada
2017-11-01 19:19:42 -04:00
parent 5026b4f9fd
commit 3665704a9a

View File

@@ -21,7 +21,8 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
CourseOutlineXBlockModal = BaseModal.extend({
events: _.extend({}, BaseModal.prototype.events, {
'click .action-save': 'save'
'click .action-save': 'save',
keydown: 'keyHandler'
}),
options: $.extend({}, BaseModal.prototype.options, {
@@ -102,6 +103,12 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
});
return $.extend.apply(this, [true, {}].concat(requestData));
},
keyHandler: function(event) {
if (event.which === 27) { // escape key
this.hide();
}
}
});