Allow to reopen a dialog in dashboard previews
This commit is contained in:
parent
ded244c9ff
commit
c3cb813c23
2 changed files with 9 additions and 3 deletions
|
@ -67,7 +67,7 @@
|
|||
const container = this.parentNode
|
||||
container.innerHTML = data
|
||||
Array.prototype.forEach.call(
|
||||
container.querySelectorAll('script'),
|
||||
container.querySelectorAll('script:not([type="application/json"])'),
|
||||
function (item) {
|
||||
eval(item.firstChild.textContent)
|
||||
}
|
||||
|
|
|
@ -28,12 +28,18 @@
|
|||
{{ block.super }}
|
||||
<script type="text/javascript">
|
||||
!(function () {
|
||||
const CACHE = {}
|
||||
for (const mapOpener of document.querySelectorAll("button.map-opener")) {
|
||||
mapOpener.addEventListener('click', (event) => {
|
||||
event.target.nextElementSibling.showModal()
|
||||
const mapId = event.target.dataset.mapId
|
||||
if (!document.querySelector(`#${mapId}_target`).hasChildNodes()) {
|
||||
const previewSettings = JSON.parse(document.getElementById(mapId).textContent)
|
||||
const map = new L.U.Map(`${mapId}_target`, previewSettings)
|
||||
CACHE[mapId] = map
|
||||
} else {
|
||||
CACHE[mapId].invalidateSize()
|
||||
}
|
||||
})
|
||||
}
|
||||
})()
|
||||
|
|
Loading…
Reference in a new issue