mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -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:
|
else:
|
||||||
raise e
|
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(
|
return render_template(
|
||||||
'views/templates/template.html',
|
'views/templates/template.html',
|
||||||
template=get_template(
|
template=get_template(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{% from "components/form.html" import form_wrapper %}
|
{% from "components/form.html" import form_wrapper %}
|
||||||
{% from "components/button/macro.njk" import govukButton %}
|
{% 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
|
<div
|
||||||
class='banner{% if type %}-{{ type }}{% endif %}{% if with_tick %}-with-tick{% endif %}'
|
class='banner{% if type %}-{{ type }}{% endif %}{% if with_tick %}-with-tick{% endif %}'
|
||||||
{% if type == 'dangerous' %}
|
{% if type == 'dangerous' %}
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
{% call form_wrapper(action=action) %}
|
{% call form_wrapper(action=action) %}
|
||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||||
{{ govukButton({
|
{{ 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",
|
"name": "delete",
|
||||||
"classes": "govuk-button--warning govuk-!-margin-top-2",
|
"classes": "govuk-button--warning govuk-!-margin-top-2",
|
||||||
}) }}
|
}) }}
|
||||||
@@ -34,6 +35,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro banner_wrapper(type=None, with_tick=False, delete_button=None, subhead=None, action=None, id=None) %}
|
{% 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) }}
|
{{ banner(caller()|safe, type=type, with_tick=with_tick, delete_button=delete_button, subhead=subhead, action=action, id=id, thing=thing) }}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
'default' if ((category == 'default') or (category == 'default_with_tick')) else 'dangerous',
|
'default' if ((category == 'default') or (category == 'default_with_tick')) else 'dangerous',
|
||||||
delete_button=delete_button_text,
|
delete_button=delete_button_text,
|
||||||
with_tick=True if category == 'default_with_tick' else False,
|
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>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user