Hide ‘delete’ link if template’s already deleted

This commit is contained in:
Chris Hill-Scott
2017-10-18 11:36:26 +01:00
parent ad8a35b045
commit 60a3ad72f9
2 changed files with 7 additions and 4 deletions

View File

@@ -64,10 +64,12 @@
<br/>
{% endif %}
{% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %}
<span class="page-footer-delete-link page-footer-delete-link-without-button bottom-gutter-2-3">
<a href="{{ url_for('.delete_service_template', service_id=current_service.id, template_id=template.id) }}">Delete this template</a>
</span>
&emsp;
{% if not template._template.archived %}
<span class="page-footer-delete-link page-footer-delete-link-without-button bottom-gutter-2-3">
<a href="{{ url_for('.delete_service_template', service_id=current_service.id, template_id=template.id) }}">Delete this template</a>
</span>
&emsp;
{% endif %}
{% if not template._template.redact_personalisation %}
<span class="page-footer-delete-link page-footer-delete-link-without-button">
<a href="{{ url_for('.confirm_redact_template', service_id=current_service.id, template_id=template.id) }}">Hide personalisation after sending</a>

View File

@@ -860,6 +860,7 @@ def test_should_show_page_for_a_deleted_template(
assert url_for("main.edit_service_template", service_id=fake_uuid, template_id=fake_uuid) not in content
assert url_for("main.send_test", service_id=fake_uuid, template_id=fake_uuid) not in content
assert page.select('p.hint')[0].text.strip() == 'This template was deleted today at 3:00pm.'
assert 'Delete this template' not in page.select_one('main').text
mock_get_deleted_template.assert_called_with(service_id, template_id)