cosmetic: remove flashed message after 5 secs

This commit is contained in:
Emmanuel Viennet 2023-04-14 16:35:24 +02:00
parent c4f948912b
commit 010583ffc5
3 changed files with 24 additions and 13 deletions

View File

@ -62,7 +62,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="container"> <div class="container flashes">
{% with messages = get_flashed_messages(with_categories=true) %} {% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %} {% for category, message in messages %}
<div class="alert alert-info alert-{{ category }}" role="alert">{{ message }}</div> <div class="alert alert-info alert-{{ category }}" role="alert">{{ message }}</div>
@ -72,6 +72,14 @@
{# application content needs to be provided in the app_content block #} {# application content needs to be provided in the app_content block #}
{% block app_content %}{% endblock %} {% block app_content %}{% endblock %}
</div> </div>
<script>
setTimeout(function() {
var flashes = document.getElementsByClassName("flashes")[0];
if (flashes) {
flashes.style.display = "none";
}
}, 5000);
</script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}

View File

@ -1,9 +1,18 @@
{# Message flask : utilisé uniquement par les anciennes pages ScoDoc #} {# Messages flask (flash) #}
{# -*- mode: jinja-html -*- #}
<div class="head_message_container"> <div class="container flashes">
{% with messages = get_flashed_messages(with_categories=true) %} {% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %} {% for category, message in messages %}
<div class="head_message alert-info alert-{{ category }}" role="alert">{{ message }}</div> <div class="alert alert-info alert-{{ category }}" role="alert">{{ message }}</div>
{% endfor %} {% endfor %}
{% endwith %} {% endwith %}
</div> </div>
<script>
setTimeout(function() {
var flashes = document.getElementsByClassName("flashes")[0];
if (flashes) {
flashes.style.display = "none";
}
}, 5000);
</script>

View File

@ -24,13 +24,7 @@
{% endblock %} {% endblock %}
<div id="gtrcontent" class="gtrcontent"> <div id="gtrcontent" class="gtrcontent">
<div class="container"> {% include "flashed_messages.j2" %}
{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<div class="alert alert-info alert-{{ category }}" role="alert">{{ message }}</div>
{% endfor %}
{% endwith %}
</div>
{% if sco.sem %} {% if sco.sem %}
{% block formsemestre_header %} {% block formsemestre_header %}
{% include "formsemestre_header.j2" %} {% include "formsemestre_header.j2" %}