Merge pull request #3003 from tchak/fix-instructeurs-list
Fix instructeurs list filter
This commit is contained in:
commit
1d1a15bf70
1 changed files with 11 additions and 1 deletions
|
@ -20,10 +20,20 @@ delegate('ajax:send', '[data-remote]', ({ target }) => {
|
||||||
// jQuery-less version of rails-ujs it breaks.
|
// jQuery-less version of rails-ujs it breaks.
|
||||||
// https://github.com/Sology/smart_listing/blob/master/app/assets/javascripts/smart_listing.coffee.erb#L9
|
// https://github.com/Sology/smart_listing/blob/master/app/assets/javascripts/smart_listing.coffee.erb#L9
|
||||||
addEventListener('load', () => {
|
addEventListener('load', () => {
|
||||||
const { href } = Rails;
|
const { href, handleRemote } = Rails;
|
||||||
Rails.href = function(element) {
|
Rails.href = function(element) {
|
||||||
return element.href || href(element);
|
return element.href || href(element);
|
||||||
};
|
};
|
||||||
|
Rails.handleRemote = function(e) {
|
||||||
|
if (this instanceof HTMLElement) {
|
||||||
|
handleRemote.call(this, e);
|
||||||
|
} else {
|
||||||
|
let element = e.find('[data-remote]')[0];
|
||||||
|
let event = new CustomEvent('click');
|
||||||
|
Object.defineProperty(event, 'target', { value: element });
|
||||||
|
return handleRemote.call(element, event);
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// rails-ujs installs CSRFProtection for its own ajax implementation. We might need
|
// rails-ujs installs CSRFProtection for its own ajax implementation. We might need
|
||||||
|
|
Loading…
Add table
Reference in a new issue