don't stop propagation in dashboard

Stopping click propagation should be avoided when used as a hack
for something else, as it interacts poorly with the open/close
mechanics of Bootstrap menus (amongst others).
(more [here](http://css-tricks.com/dangers-stopping-event-propagation/)

This code preserves the intended behaviour (toggling the checkbox when
clicking on the row, except for the link) without resorting to
`stopPropagation()`
This commit is contained in:
Mathieu 2015-02-06 00:39:09 +01:00
parent 2aac3e913a
commit cbd7f1fc98

View File

@ -336,16 +336,11 @@ define([
checkbox.css('visibility', 'hidden'); checkbox.css('visibility', 'hidden');
} else if (selectable === true) { } else if (selectable === true) {
var that = this; var that = this;
link.click(function(e) {
e.stopPropagation();
});
checkbox.click(function(e) {
e.stopPropagation();
that._selection_changed();
});
row.click(function(e) { row.click(function(e) {
e.stopPropagation(); // toggle checkbox only if the click doesn't come from the checkbox or the link
if (!$(e.target).is('span[class=item_name]') && !$(e.target).is('input[type=checkbox]')) {
checkbox.prop('checked', !checkbox.prop('checked')); checkbox.prop('checked', !checkbox.prop('checked'));
}
that._selection_changed(); that._selection_changed();
}); });
} }