mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-22 06:03:06 -04:00
Add context to banner button text
Needs flash messaging system changes.
This commit is contained in:
@@ -690,7 +690,7 @@ def delete_service_template(service_id, template_id):
|
||||
else:
|
||||
raise e
|
||||
|
||||
flash(["Are you sure you want to delete ‘{}’?".format(template['name']), message], 'delete')
|
||||
flash(["Are you sure you want to delete ‘{}’?".format(template['name']), message, template['name']], 'delete')
|
||||
return render_template(
|
||||
'views/templates/template.html',
|
||||
template=get_template(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
{% from "components/button/macro.njk" import govukButton %}
|
||||
|
||||
{% macro banner(body, type=None, with_tick=False, delete_button=None, subhead=None, context=None, action=None, id=None) %}
|
||||
{% macro banner(body, type=None, with_tick=False, delete_button=None, subhead=None, context=None, action=None, id=None, thing=None) %}
|
||||
<div
|
||||
class='banner{% if type %}-{{ type }}{% endif %}{% if with_tick %}-with-tick{% endif %}'
|
||||
{% if type == 'dangerous' %}
|
||||
@@ -25,7 +25,8 @@
|
||||
{% call form_wrapper(action=action) %}
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
{{ govukButton({
|
||||
"text": delete_button,
|
||||
"text": "" if thing else delete_button,
|
||||
"html": delete_button + "<span class=\"govuk-visually-hidden\"> ‘" + thing + "’</span>" if thing else "",
|
||||
"name": "delete",
|
||||
"classes": "govuk-button--warning govuk-!-margin-top-2",
|
||||
}) }}
|
||||
@@ -34,6 +35,6 @@
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro banner_wrapper(type=None, with_tick=False, delete_button=None, subhead=None, action=None, id=None) %}
|
||||
{{ banner(caller()|safe, type=type, with_tick=with_tick, delete_button=delete_button, subhead=subhead, action=action, id=id) }}
|
||||
{% macro banner_wrapper(type=None, with_tick=False, delete_button=None, subhead=None, action=None, id=None, thing=None) %}
|
||||
{{ banner(caller()|safe, type=type, with_tick=with_tick, delete_button=delete_button, subhead=subhead, action=action, id=id, thing=thing) }}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
'default' if ((category == 'default') or (category == 'default_with_tick')) else 'dangerous',
|
||||
delete_button=delete_button_text,
|
||||
with_tick=True if category == 'default_with_tick' else False,
|
||||
context=message[1] if message is not string
|
||||
context=message[1] if message is not string,
|
||||
thing=message[2] if message is not string and message[2]
|
||||
)}}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user