{% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} - + {% for category, message in messages %} + {{ banner(message, 'dangerous', delete_button="Yes, delete this template" if 'delete' == category else None)}} + {% endfor %} {% endif %} {% endwith %} {% block fullwidth_content %}{% endblock %} diff --git a/app/templates/components/banner.html b/app/templates/components/banner.html index 39e0a1e5f..8adbfa5c6 100644 --- a/app/templates/components/banner.html +++ b/app/templates/components/banner.html @@ -1,5 +1,11 @@ -{% macro banner(body, type=None, with_tick=False) %} +{% macro banner(body, type=None, with_tick=False, delete_button=None) %}
{{ body }} + {% if delete_button %} +
+ + +
+ {% endif %}
{% endmacro %} diff --git a/app/templates/views/styleguide.html b/app/templates/views/styleguide.html index edf2a753c..2dde4716a 100644 --- a/app/templates/views/styleguide.html +++ b/app/templates/views/styleguide.html @@ -22,14 +22,25 @@

View source

Banner

-

Used to show the result of a user’s action.

- {{ banner("This is a banner", with_tick=True) }} +

Used to show the status of a thing or action.

+ + {{ banner("You sent 1,234 text messages", with_tick=True) }} +
{{ banner("Delivered 10:20") }}
+ {{ banner( + 'Your service is in restricted mode. You can only send notifications to yourself.', + 'info' + ) }} + + {{ banner('You’re not allowed to do this', 'dangerous')}} + + {{ banner('Are you sure you want to delete?', 'dangerous', delete_button="Yes, delete this thing")}} +

Big number

Used to show some important statistics.