chore: generate messages following map creation
Also, reuse the `U` global namespace for `MAP`.
This commit is contained in:
parent
61d3e70ae0
commit
5c0ca55f8c
3 changed files with 10 additions and 16 deletions
|
@ -24,5 +24,4 @@
|
||||||
{% block map_init %}
|
{% block map_init %}
|
||||||
{% include "umap/map_init.html" %}
|
{% include "umap/map_init.html" %}
|
||||||
{% endblock map_init %}
|
{% endblock map_init %}
|
||||||
{% include "umap/map_messages.html" %}
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
|
@ -2,9 +2,16 @@
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<!-- djlint:off -->
|
<!-- djlint:off -->
|
||||||
<script defer type="text/javascript">
|
<script defer type="text/javascript">
|
||||||
let MAP
|
|
||||||
window.addEventListener('DOMContentLoaded', (event) => {
|
window.addEventListener('DOMContentLoaded', (event) => {
|
||||||
MAP = new U.Map("map", {{ map_settings|notag|safe }});
|
U.MAP = new U.Map("map", {{ map_settings|notag|safe }})
|
||||||
});
|
{% for m in messages %}
|
||||||
|
{# We have just one, but we need to loop, as for messages API #}
|
||||||
|
U.MAP.ui.alert({
|
||||||
|
content: "{{ m }}",
|
||||||
|
level: "{{ m.tags }}",
|
||||||
|
duration: 100000
|
||||||
|
})
|
||||||
|
{% endfor %}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<!-- djlint:on -->
|
<!-- djlint:on -->
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
<script type="text/javascript">
|
|
||||||
window.addEventListener('DOMContentLoaded', (event) => {
|
|
||||||
{% for m in messages %}
|
|
||||||
{# We have just one, but we need to loop, as for messages API #}
|
|
||||||
MAP.ui.alert({
|
|
||||||
content: "{{ m }}",
|
|
||||||
level: "{{ m.tags }}",
|
|
||||||
duration: 100000
|
|
||||||
})
|
|
||||||
{% endfor %}
|
|
||||||
})
|
|
||||||
</script>
|
|
Loading…
Reference in a new issue