Merge pull request #1631 from umap-project/no-global-map-namespace

chore: generate messages following map creation
This commit is contained in:
David Larlet 2024-02-20 08:23:38 -05:00 committed by GitHub
commit 5e3058e54b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 16 deletions

View file

@ -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 %}

View file

@ -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 -->

View file

@ -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>