tinternet.net/core/Resources/views/admin/module/flashes.html.twig

52 lines
1.8 KiB
Twig
Raw Normal View History

2021-03-16 10:37:12 +01:00
{% set flashes = app.flashes %}
{% if flashes|length %}
{% set colors = {
'info': 'text-body',
'notice': 'text-body',
'success': 'text-success font-weight-bold',
'warning': 'text-warning font-weight-bold',
'danger': 'text-danger font-weight-bold',
'error': 'text-danger font-weight-bold',
} %}
{% set titles = {
'notice': 'Information',
'info': 'Information',
2021-03-24 17:09:13 +01:00
'success': 'Success',
'warning': 'Warning',
2021-03-16 10:37:12 +01:00
'danger': 'Danger',
2021-03-24 17:09:13 +01:00
'error': 'Error',
2021-03-16 10:37:12 +01:00
} %}
{% set borders = {
'notice': '',
'info': 'border border-primary',
'success': 'border border-success',
'warning': 'border border-warning',
'danger': 'border border-danger',
'error': 'border border-danger',
} %}
<div aria-live="polite" aria-atomic="true" class="toast-container">
<div class="toast-wrapper">
{% for label, messages in flashes %}
{% for message in messages %}
<div class="toast {{ borders[label] }}" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
2021-03-24 17:09:13 +01:00
<strong class="mr-auto">{{ titles[label]|trans }}</strong>
2021-03-16 10:37:12 +01:00
<small>{{ 'now'|date('H:i') }}</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body text-{{ colors[label] }}">
2021-03-24 17:09:13 +01:00
{{ message|trans|nl2br }}
2021-03-16 10:37:12 +01:00
</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
{% endif %}