Commit 0a8a006c authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Initialize rails-ujs earlier

This fixes problems where users could click buttons before the event
handlers are setup.
parent e283ef06
......@@ -97,6 +97,8 @@ gl.lazyLoader = new LazyLoader({
observerNode: '#content-body',
});
initRails();
// Put all initialisations here that can also wait after everything is rendered and ready
function deferredInitialisation() {
const $body = $('body');
......@@ -170,8 +172,6 @@ function deferredInitialisation() {
// Adding a helper class to activate animations only after all is rendered
setTimeout(() => $body.addClass('page-initialised'), 1000);
initRails();
}
document.addEventListener('DOMContentLoaded', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment