mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-23 20:35:03 +02:00
Added an system for showing flash messages to user.
This commit is contained in:
parent
cc1badb853
commit
2d18014b35
6 changed files with 146 additions and 6 deletions
|
@ -101,11 +101,42 @@
|
|||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="toast-container ">
|
||||
{% for label, messages in app.flashes() %}
|
||||
{% for message in messages %}
|
||||
{% set flash_title = label|replace({'success': 'flash.success', 'error': 'flash.error'
|
||||
, 'warning': 'flash.warning', 'notice': 'flash.notice', 'info': 'flash.info'}) %}
|
||||
{% set flash_symbol = label|replace({'success': 'fa-check-circle', 'error': 'fa-exclamation-triangle'
|
||||
, 'warning': 'fa-exclamation-circle', 'notice': 'fa-flag', 'info': 'fa-flag'}) %}
|
||||
|
||||
{% set flash_bg = label|replace({'success': 'bg-success text-white',
|
||||
'error': 'bg-danger text-white', 'warning': 'bg-warning text-white',
|
||||
'notice': 'bg-info text-white', 'info': 'bg'})%}
|
||||
|
||||
<div class="toast " role="alert" aria-live="assertive" aria-atomic="true" data-delay="2000">
|
||||
<div class="toast-header {{ flash_bg }}">
|
||||
{# <img src="..." class="rounded mr-2" alt="...">#}
|
||||
<i class="fas fa-fw {{ flash_symbol }} mr-2"></i>
|
||||
<strong class="mr-auto">{{ flash_title|trans }}</strong>
|
||||
{#<small class="text-muted">11 mins ago</small> #}
|
||||
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body {{ flash_bg }}">
|
||||
{{ message}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row">
|
||||
<div class="collapse d-md-block bg-light" id="sidebar-container">
|
||||
<nav class="fixed-sidebar col-md-3 col-lg-2 " id="fixed-sidebar">
|
||||
|
@ -258,6 +289,10 @@
|
|||
|
||||
<script src="{{ asset('helper/datatables.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$(".toast").toast('show');
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue