mirror of https://git.48k.eu/ogcp
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.master
parent
c2fd182fb6
commit
651589d690
|
@ -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 %}
|
||||
|
|
Loading…
Reference in New Issue