Allow flash messages to appear a second time

This commit is contained in:
Sebastian Serth
2021-04-19 12:59:16 +02:00
parent ccd9821b4f
commit 434ea0595e

View File

@ -40,10 +40,16 @@ $( document ).on('turbolinks:load', function() {
container.animation = setTimeout(hide, DURATION);
}
button.on('click', function () {
clearTimeout(container.animation);
hide();
});
// This will be fired by Bootstrap automatically
container.on('close.bs.alert', function (e) {
// Did the user click on the on the button to close?
if (e.target instanceof Element || e.target instanceof HTMLElement) {
clearTimeout(container.animation);
hide();
}
// We need to stop event propagation here. Otherwise, Bootstrap would remove the DOM element
e.preventDefault();
})
});
};