Don’t show send/edit links for deleted template

Since you can’t really send or edit a deleted template we should show
a message telling you that the template has been deleted.

This is important because deleted templates still show up in the
template statistics.
This commit is contained in:
Chris Hill-Scott
2016-07-01 13:10:19 +01:00
parent 0d44fc770c
commit 02dccde0bd
4 changed files with 87 additions and 22 deletions

View File

@@ -16,15 +16,21 @@
{% endif %}
</div>
<div class="column-one-third">
<div class="message-use-links{% if show_title %}-with-title{% endif %}">
{% if current_user.has_permissions(permissions=['send_texts', 'send_emails', 'send_letters']) %}
<a href="{{ url_for(".send_messages", service_id=current_service.id, template_id=template.id) }}" class="primary">
Send {{ 'text messages' if 'sms' == template.template_type else 'emails' }}
</a>
{% endif %}
{% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %}
<a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}">Edit template</a>
{% endif %}
<a href="{{ url_for(".send_from_api", service_id=current_service.id, template_id=template.id) }}">API info</a>
</div>
{% if template._template.archived %}
<div class="message-updated-at">
This template was deleted<br/>{{ template._template.updated_at|format_date_normal }}
</div>
{% else %}
<div class="message-use-links{% if show_title %}-with-title{% endif %}">
{% if current_user.has_permissions(permissions=['send_texts', 'send_emails', 'send_letters']) %}
<a href="{{ url_for(".send_messages", service_id=current_service.id, template_id=template.id) }}" class="primary">
Send {{ 'text messages' if 'sms' == template.template_type else 'emails' }}
</a>
{% endif %}
{% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %}
<a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}">Edit template</a>
{% endif %}
<a href="{{ url_for(".send_from_api", service_id=current_service.id, template_id=template.id) }}">API info</a>
</div>
{% endif %}
</div>