diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-06-11 10:24:48 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-06-13 17:38:44 +0200 |
commit | 651589d69091c0bd6a554d1f47133121679615ed (patch) | |
tree | 3970d6ecd3ac32f9132fc8300858e64d772eeb04 /ogcp | |
parent | c2fd182fb6dbfe1f07bccfe1291a006e9d969b94 (diff) |
templates: fix error report with multiple messages
Fix the definition of javascript code to generate a correct
message window for multiple error messages.
The error is cause by a redefinition of 'let bgclass' in multiple
lines when the html template receives multiple error messages.
Each iteration to generate the code for the error messages tries
to redefine the variable bgclass and it causes the js to fail.
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/templates/base.html | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ogcp/templates/base.html b/ogcp/templates/base.html index f43f4bd..0037f79 100644 --- a/ogcp/templates/base.html +++ b/ogcp/templates/base.html @@ -115,8 +115,9 @@ <script> // error messages + $(document).ready(function() { {% for category, message in get_flashed_messages(with_categories=True) %} - let bgclass = 'bg-success'; + var bgclass = 'bg-success'; {% if category == 'info' %} bgclass = 'bg-info'; {% elif category == 'error' %} @@ -129,9 +130,10 @@ position: 'bottomRight', autohide: true, delay: 30000, - title: '{{ message }}', + title: {{ message|tojson|safe }}, }) {% endfor %} + }); </script> {% block extrabody %}{% endblock %} |