FIX: clicking the 'edit permission' button would close the category modal

This commit is contained in:
Régis Hanol 2014-09-09 10:16:12 +02:00
parent c093187d34
commit 357c43e941

View File

@ -4,10 +4,14 @@ export default Ember.View.extend({
classNameBindings: [':modal', ':hidden', 'controller.modalClass'], classNameBindings: [':modal', ':hidden', 'controller.modalClass'],
click: function(e) { click: function(e) {
var $target = $(e.target);
// some buttons get removed from the DOM when you click on them.
// we don't want to close the modal when we click on those...
if ($target.parent().length > 0 &&
$target.closest('.modal-inner-container').length === 0) {
// Delegate click to modal backdrop if clicked outside. We do this // Delegate click to modal backdrop if clicked outside. We do this
// because some CSS of ours seems to cover the backdrop and makes it // because some CSS of ours seems to cover the backdrop and makes it
// unclickable. // unclickable.
if ($(e.target).closest('.modal-inner-container').length === 0) {
$('.modal-backdrop').click(); $('.modal-backdrop').click();
} }
} }