mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-22 22:22:49 -04:00
Make sure confirmation/danger banners have a H1
This makes errors on all pages have a `<h1>` element, which is important for accessibility. It means a bit of rewriting the messages, but I think they’re better for it.
This commit is contained in:
@@ -428,22 +428,24 @@ def delete_service_template(service_id, template_id):
|
||||
last_used_notification = template_statistics_client.get_template_statistics_for_template(
|
||||
service_id, template['id']
|
||||
)
|
||||
message = '{} was last used {} ago'.format(
|
||||
last_used_notification['template']['name'],
|
||||
message = 'It was last used {} ago.'.format(
|
||||
get_human_readable_delta(
|
||||
parse(last_used_notification['created_at']).replace(tzinfo=None),
|
||||
datetime.utcnow())
|
||||
datetime.utcnow()
|
||||
)
|
||||
)
|
||||
except HTTPError as e:
|
||||
if e.status_code == 404:
|
||||
message = '{} has never been used'.format(template['name'])
|
||||
message = 'It’s never been used.'.format(template['name'])
|
||||
else:
|
||||
raise e
|
||||
|
||||
flash('{}. Are you sure you want to delete it?'.format(message), 'delete')
|
||||
|
||||
return render_template(
|
||||
'views/templates/template.html',
|
||||
template_delete_confirmation_message=(
|
||||
'Are you sure you want to delete {}?'.format(template['name']),
|
||||
message,
|
||||
),
|
||||
template=get_template(
|
||||
template,
|
||||
current_service,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{% endif %}
|
||||
>
|
||||
{% if subhead -%}
|
||||
{{ subhead }} 
|
||||
<h1 class="banner-title">{{ subhead }}</h1>
|
||||
{%- endif -%}
|
||||
{{ body }}
|
||||
{% if delete_button %}
|
||||
|
||||
@@ -29,6 +29,20 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if template_delete_confirmation_message %}
|
||||
<div class="bottom-gutter">
|
||||
{% call banner_wrapper(type='dangerous', subhead=template_delete_confirmation_message[0]) %}
|
||||
<p>
|
||||
{{ template_delete_confirmation_message[1] }}
|
||||
</p>
|
||||
<form method='post'>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="submit" class="button" name="delete" value="Confirm" />
|
||||
</form>
|
||||
{% endcall %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h1 class="heading-large">{{ template.name }}</h1>
|
||||
|
||||
<div class="grid-row">
|
||||
|
||||
Reference in New Issue
Block a user