Move parameters out of the …_message components

This commit refactors the `email_message` and `sms_message` UI components to
take fewer parameters.

`name`, `edit_link` and anything to do with versions are identical for both
text and email messages so I’ve moved them to the pages where you choose a
template or see the versions.

This commit also tidies up the wording and styling of the template history
stuff.
This commit is contained in:
Chris Hill-Scott
2016-05-26 17:05:16 +01:00
parent 01884655c7
commit b84d06bd68
12 changed files with 77 additions and 144 deletions

View File

@@ -1,32 +1,13 @@
{% macro email_message(
subject,
body,
name=None,
edit_link=None,
from_name=None,
from_address=None,
recipient=None,
id=None,
updated_at=None,
versions_url=None,
version=1,
show_placeholder_for_recipient=False,
show_id=False
) %}
{% if name %}
<h3 class="email-message-name">
{% if edit_link %}
<a href="{{ edit_link }}">{{ name }}</a>
{% else %}
{{ name }}
{% endif %}
</h3>
{% endif %}
{% if version > 1 %}
{% if updated_at %}
<p class="email-message-updated-at">Last updated on {{ updated_at|format_date_normal }} <a href="{{ versions_url }}">see earlier versions</a></p>
{% endif %}
{% endif %}
<div class="email-message">
{% if from_name or subject %}
<table class="email-message-meta">

View File

@@ -1,9 +1,7 @@
{% macro sms_message(
body,
recipient=None,
name=None,
id=None,
edit_link=None,
from=None,
version=1,
updated_at=None,
@@ -11,20 +9,6 @@
show_placeholder_for_recipient=False,
show_id=False
) %}
{% if name %}
<h3 class="sms-message-name">
{% if edit_link %}
<a name="{{ name|linkable_name }}" href="{{ edit_link }}">{{ name }}</a>
{% else %}
{{ name }}
{% endif %}
</h3>
{% endif %}
{% if version > 1 %}
{% if updated_at %}
<p class="sms-message-updated-at">Last updated on {{ updated_at|format_date_normal }} <a href="{{ versions_url }}">see earlier versions</a></p>
{% endif %}
{% endif %}
{% if recipient is not none %}
<p class="sms-message-recipient">
To: