Put CSS and JS blocks to their dedicated places

This commit is contained in:
David Larlet 2023-12-20 22:02:00 -05:00
parent 8d11815625
commit ded244c9ff
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD
3 changed files with 33 additions and 32 deletions

View file

@ -296,9 +296,9 @@ table.maps {
width: 100%; width: 100%;
} }
table.maps .map_fragment { table.maps .map_fragment {
height: 100px; display: block;
height: 80vh;
width: 100%; width: 100%;
min-width: 200px;
} }
table.maps tbody tr:nth-child(odd) { table.maps tbody tr:nth-child(odd) {
background-color: #f4f4f4; background-color: #f4f4f4;
@ -310,6 +310,21 @@ table.maps thead tr {
line-height: 2em; line-height: 2em;
} }
/* **************************** */
/* Dialog */
/* **************************** */
dialog {
width: 90vw;
height: 90vh;
}
dialog::backdrop {
background: #fff5;
backdrop-filter: blur(4px);
}
.close-dialog {
text-align: center;
}
/* ************************************************* */ /* ************************************************* */
/* ********************* MOBILE ******************** */ /* ********************* MOBILE ******************** */

View file

@ -49,33 +49,3 @@
class="button more_button neutral">{% trans "More" %}</a> class="button more_button neutral">{% trans "More" %}</a>
</div> </div>
{% endif %} {% endif %}
<style type="text/css">
dialog {
width: 90vw;
height: 90vh;
}
.close-dialog {
text-align: center;
}
table.maps .map_fragment {
display: block;
width: 100%;
height: 80vh;
}
dialog::backdrop {
background: #fff5;
backdrop-filter: blur(4px);
}
</style>
<script type="text/javascript">
for (const mapOpener of document.querySelectorAll("button.map-opener")) {
mapOpener.addEventListener('click', (event) => {
event.target.nextElementSibling.showModal()
const mapId = event.target.dataset.mapId
const previewSettings = JSON.parse(document.getElementById(mapId).textContent)
const map = new L.U.Map(`${mapId}_target`, previewSettings)
})
}
</script>

View file

@ -23,3 +23,19 @@
</div> </div>
</div> </div>
{% endblock maincontent %} {% endblock maincontent %}
{% block bottom_js %}
{{ block.super }}
<script type="text/javascript">
!(function () {
for (const mapOpener of document.querySelectorAll("button.map-opener")) {
mapOpener.addEventListener('click', (event) => {
event.target.nextElementSibling.showModal()
const mapId = event.target.dataset.mapId
const previewSettings = JSON.parse(document.getElementById(mapId).textContent)
const map = new L.U.Map(`${mapId}_target`, previewSettings)
})
}
})()
</script>
{% endblock bottom_js %}