Merge pull request #2501 from alphagov/update_confirm_delete_messages

Make deletion confirmation banner messages consistent across our app
This commit is contained in:
Pea (Malgorzata Tyczynska)
2018-11-19 10:37:48 +00:00
committed by GitHub
13 changed files with 49 additions and 89 deletions

View File

@@ -1,4 +1,4 @@
{% macro banner(body, type=None, with_tick=False, delete_button=None, subhead=None) %}
{% macro banner(body, type=None, with_tick=False, delete_button=None, subhead=None, context=None) %}
<div
class='banner{% if type %}-{{ type }}{% endif %}{% if with_tick %}-with-tick{% endif %}'
{% if type == 'dangerous' %}
@@ -10,6 +10,11 @@
<h1 class="banner-title">{{ subhead }}</h1>
{%- endif -%}
{{ body }}
{% if context %}
<p>
{{ context }}
</p>
{% endif %}
{% if delete_button %}
<form method='post'>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />

View File

@@ -4,10 +4,11 @@
{% for category, message in messages %}
<div class="bottom-gutter">
{{ banner(
message,
message if message is string else message[0],
'default' if ((category == 'default') or (category == 'default_with_tick')) else 'dangerous',
delete_button="Yes, {}".format(category) if category in ['delete', 'suspend', 'resume', 'remove'] else None,
with_tick=True if category == 'default_with_tick' else False
delete_button="Yes, {}".format(category) if category in ['delete', 'suspend', 'resume', 'remove', 'revoke this API key'] else None,
with_tick=True if category == 'default_with_tick' else False,
context=message[1] if message is not string
)}}
</div>
{% endfor %}

View File

@@ -10,30 +10,16 @@
{% block maincolumn_content %}
{% if revoke_key %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous', subhead='Are you sure you want to revoke this API key?') %}
<p>
{{ revoke_key }} will no longer let you connect to GOV.UK Notify.
</p>
<form method='post'>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<button type="submit" class="button" name="delete">Confirm</button>
</form>
{% endcall %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-large">
API keys
</h1>
</div>
{% else %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-large">
API keys
</h1>
</div>
<div class="column-one-third">
<a href="{{ url_for('.create_api_key', service_id=current_service.id) }}" class="button align-with-heading">Create an API key</a>
</div>
<div class="column-one-third">
<a href="{{ url_for('.create_api_key', service_id=current_service.id) }}" class="button align-with-heading">Create an API key</a>
</div>
{% endif %}
</div>
<div class="body-copy-table">
{% call(item, row_number) list_table(

View File

@@ -11,20 +11,9 @@
{% block maincolumn_content %}
{% if confirm_delete %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous', subhead="Are you sure you want to delete this email reply-to address?") %}
<form method='post'>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" class="button" name="delete" value="Confirm" />
</form>
{% endcall %}
</div>
{% else %}
<h1 class="heading-large">
Edit email reply to address
</h1>
{% endif %}
<h1 class="heading-large">
Edit email reply to address
</h1>
{% call form_wrapper() %}
{{ textbox(
form.email_address,

View File

@@ -11,20 +11,9 @@
{% block maincolumn_content %}
{% if confirm_delete %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous', subhead="Are you sure you want to delete this text message sender?") %}
<form method='post'>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" class="button" name="delete" value="Confirm" />
</form>
{% endcall %}
</div>
{% else %}
<h1 class="heading-large">
Edit text message sender
</h1>
{% endif %}
<h1 class="heading-large">
Edit text message sender
</h1>
{% call form_wrapper() %}
{% if inbound_number %}
<p>

View File

@@ -27,20 +27,6 @@
</form>
{% endcall %}
</div>
{% elif template_delete_confirmation_message %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous', subhead=template_delete_confirmation_message[0]) %}
{% if template_delete_confirmation_message[1] %}
<p>
{{ template_delete_confirmation_message[1] }}
</p>
{% endif %}
<form method='post'>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<button type="submit" class="button" name="delete">Confirm</button>
</form>
{% endcall %}
</div>
{% else %}
<h1 class="heading-large">{{ template.name }}</h1>
{% endif %}