messages.html.twig 594 B

1234567891011121314151617
  1. {% set type_mapping = {'info':'success', 'error': 'error', 'warning': 'warning'} %}
  2. {% set icon_mapping = {'info':'checkmark', 'error':'wrong', 'warning':'information'} %}
  3. {% if grav.messages.all %}
  4. <div id="messages">
  5. {% for message in grav.messages.fetch %}
  6. {% set scope = message.scope|e %}
  7. {% set type = type_mapping[scope] %}
  8. {% set icon = icon_mapping[scope] %}
  9. <div class="toast toast-{{ type }} {{ scope }}">
  10. <i class="icon dripicons-{{ icon }}"></i> {{ message.message|raw }}
  11. </div>
  12. {% endfor %}
  13. </div>
  14. {% endif %}