FIX: delegate click to modal close when pressing ESC
This commit is contained in:
parent
7a31131239
commit
3bae2cca4d
|
@ -8,15 +8,13 @@ export default ModalBodyView.extend({
|
|||
}.property('controller.flagTopic'),
|
||||
|
||||
selectedChanged: function() {
|
||||
const self = this;
|
||||
Em.run.next(() => {
|
||||
this.$("input[type='radio']").prop('checked', false);
|
||||
|
||||
Em.run.next(function() {
|
||||
self.$("input[type='radio']").prop('checked', false);
|
||||
|
||||
const nameKey = self.get('controller.selected.name_key');
|
||||
const nameKey = this.get('controller.selected.name_key');
|
||||
if (!nameKey) { return; }
|
||||
|
||||
self.$('#radio_' + nameKey).prop('checked', 'true');
|
||||
this.$('#radio_' + nameKey).prop('checked', 'true');
|
||||
});
|
||||
}.observes('controller.selected.name_key')
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@ export default Ember.View.extend({
|
|||
templateName: 'modal/modal',
|
||||
classNameBindings: [':modal', ':hidden', 'controller.modalClass'],
|
||||
|
||||
click: function(e) {
|
||||
click(e) {
|
||||
const $target = $(e.target);
|
||||
if ($target.hasClass("modal-middle-container") ||
|
||||
$target.hasClass("modal-outer-container")) {
|
||||
|
@ -12,5 +12,12 @@ export default Ember.View.extend({
|
|||
// the backdrop and makes it unclickable.
|
||||
$('.modal-header a.close').click();
|
||||
}
|
||||
},
|
||||
|
||||
keyDown(e) {
|
||||
// Delegate click to modal close when pressing ESC
|
||||
if (e.keyCode === 27) {
|
||||
Em.run.next(() => $('.modal-header a.close').click());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue