-
Notifications
You must be signed in to change notification settings - Fork 16
/
_flash_notification.html
31 lines (29 loc) · 1.22 KB
/
_flash_notification.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{# Flash notifications #}
{% with messages = get_flashed_messages(with_categories=True) %}
{% if messages %}
{% set category_url_indicator = '+contains-url' %}
{% for category, message in messages %}
{% set message_has_url = False %}
{% if category.endswith(category_url_indicator) %}
{% set category = category[:category.rfind(category_url_indicator)] %}
{% set message_has_url = True %}
{% endif %}
{# shift from bs2 to bs3 terminology #}
{% if category == "error" %}
{% set category = "danger" %}
{% endif %}
<div class="flash_container">
<h2 class="sr-only">Notifications</h2>
<p class="alert alert--{{category}}">
<span data-feather="alert-octagon" aria-hidden="true"></span>
{% if message_has_url %}
{{ message | safe }}
{% else %}
{{ message | safe }}
{% endif %}
<span class="flash_close alert__close" role="button">(Dismiss)</span>
</p>
</div>
{% endfor %}
{% endif %}
{% endwith %}