Initialize modals more precisely

This commit is contained in:
Gregor Kleen 2019-03-10 15:47:55 +01:00
parent 8aeeb1ddaa
commit 46544f58c6
2 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,5 @@
document.addEventListener('DOMContentLoaded', function() {
var dbtIdent = #{String $ dbtIdent};
var dbtIdent = #{String dbtIdent};
var headerDBTableShortcircuit = #{String (toPathPiece HeaderDBTableShortcircuit)};
var selector = '#' + dbtIdent + '-table-wrapper';
var wrapper = document.querySelector(selector);

View File

@ -1,7 +1,9 @@
document.addEventListener('DOMContentLoaded', function() {
// TODO: replace for loop with one precise query for this specific modal instance
var modalElements = Array.from(document.querySelectorAll('.modal'));
modalElements.forEach(function(modal) {
var modalIdent = #{String modalId};
var selector = '#modal-' + modalIdent;
var modal = document.querySelector(selector);
if (modal) {
window.utils.setup('modal', modal);
});
}
});