mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 20:43:12 -04:00
Add link to delete a template
This is a link not a button because: - it’s less prominent—delete is an infrequent action - it’s a two-step process, and only the second part changes any data (so it has a button)
This commit is contained in:
@@ -68,16 +68,22 @@
|
||||
{% endif %}
|
||||
|
||||
<main id="content" role="main" class="page-container">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="error-summary">
|
||||
<ul>
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<ul class="banner-dangerous">
|
||||
{% for category, message in messages %}
|
||||
<li class="flash-message">
|
||||
{{ message }}
|
||||
{% if 'delete' == category %}
|
||||
<form method='post'>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="submit" class="button" name="delete" value="Yes, delete this template" />
|
||||
</form>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% block fullwidth_content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
{% macro page_footer(button_text=None, back_link=False, back_link_text="Back", destructive=False) %}
|
||||
{% macro page_footer(
|
||||
button_text=None,
|
||||
destructive=False,
|
||||
back_link=False,
|
||||
back_link_text="Back",
|
||||
delete_link=False,
|
||||
delete_link_text="delete"
|
||||
) %}
|
||||
<div class="page-footer">
|
||||
{% if button_text %}
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="submit" class="button{% if destructive %}-destructive{% endif %}" value="{{ button_text }}" />
|
||||
{% endif %}
|
||||
{% if delete_link %}
|
||||
<span class="page-footer-delete-link">
|
||||
or <a href="{{ delete_link }}">{{ delete_link_text }}</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if back_link %}
|
||||
<a class="page-footer-back-link" role="button" href="{{ back_link }}">{{ back_link_text }}</a>
|
||||
<a class="page-footer-back-link" href="{{ back_link }}">{{ back_link_text }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -14,7 +14,8 @@ GOV.UK Notify | Edit template
|
||||
{{ textbox(form.template_name) }}
|
||||
{{ textbox(form.template_body, highlight_tags=True) }}
|
||||
{{ page_footer(
|
||||
'Save and continue',
|
||||
'Save',
|
||||
delete_link=url_for('.delete_template', service_id=service_id, template_id=template_id) if template_id or None,
|
||||
back_link=url_for('.manage_templates', service_id=service_id),
|
||||
back_link_text='Back to templates'
|
||||
) }}
|
||||
|
||||
@@ -14,6 +14,9 @@ GOV.UK Notify | Manage templates
|
||||
|
||||
<h1 class="heading-xlarge">Templates</h1>
|
||||
|
||||
<p>
|
||||
<a href="{{ url_for('.add_template', service_id=service_id) }}">Create new template</a>
|
||||
|
||||
{% for template in templates %}
|
||||
{% if template.type == 'sms' %}
|
||||
{{ sms_message(
|
||||
@@ -32,18 +35,6 @@ GOV.UK Notify | Manage templates
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
<div class="column-one-third">
|
||||
{{ browse_list([
|
||||
{
|
||||
'title': 'New text message template',
|
||||
'link': url_for('.add_template', service_id=service_id)
|
||||
},
|
||||
{
|
||||
'title': 'New email template',
|
||||
'link': url_for('.add_template', service_id=service_id)
|
||||
}
|
||||
]) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user