{% 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.

From e03813ceefa73e3cb7871be75408238b36070b89 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 26 Jan 2016 16:26:08 +0000 Subject: [PATCH 3/3] Make 'API key was revoked' banner green --- app/assets/stylesheets/components/banner.scss | 3 ++- app/main/views/api_keys.py | 2 +- app/templates/admin_template.html | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/components/banner.scss b/app/assets/stylesheets/components/banner.scss index f6c08fba9..e690010f0 100644 --- a/app/assets/stylesheets/components/banner.scss +++ b/app/assets/stylesheets/components/banner.scss @@ -1,5 +1,6 @@ %banner, -.banner { +.banner, +.banner-default { @include core-19; background: $turquoise; diff --git a/app/main/views/api_keys.py b/app/main/views/api_keys.py index e2d77bf31..fd29426ae 100644 --- a/app/main/views/api_keys.py +++ b/app/main/views/api_keys.py @@ -51,5 +51,5 @@ def revoke_api_key(service_id, key_id): ) elif request.method == 'POST': api_key_api_client.revoke_api_key(service_id=service_id, key_id=key_id) - flash('‘{}’ was revoked'.format(key_name)) + flash('‘{}’ was revoked'.format(key_name), 'default') return redirect(url_for('.api_keys', service_id=service_id)) diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index 42505fc90..346959cba 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -73,7 +73,11 @@ {% 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)}} + {{ banner( + message, + 'default' if category == 'default' else 'dangerous', + delete_button="Yes, delete this template" if 'delete' == category else None + )}} {% endfor %} {% endif %} {% endwith %}