Commit d7ee98b1 authored by Lukas Eipert's avatar Lukas Eipert

Move Path Locks inline JavaScript to JS-only

Rather than requesting and evaluating some JavaScript, we listen to the
`ajax:success` event directly and show the empty state once all locks
are deleted.
parent e381df33
import initDeprecatedRemoveRowBehavior from '~/behaviors/deprecated_remove_row_behavior';
document.addEventListener('DOMContentLoaded', initDeprecatedRemoveRowBehavior);
import initDeprecatedRemoveRowBehavior from '~/behaviors/deprecated_remove_row_behavior';
document.addEventListener('DOMContentLoaded', () => {
initDeprecatedRemoveRowBehavior();
const locks = document.querySelector('.locks');
locks.addEventListener('ajax:success', () => {
const allRowsHidden = [...locks.querySelectorAll('li')].every((x) => x.offsetParent === null);
if (allRowsHidden) {
locks.querySelector('.nothing-here-block.hidden')?.classList?.remove('hidden');
}
});
});
- unless @project.path_locks.any?
var emptyState = document.querySelector('.locks .nothing-here-block.hidden');
if (emptyState) emptyState.classList.remove('hidden');
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