mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Move code for rendering messages/templates → utils
Utils is better structured to handle the logic of what thing to show for what template type, especially now that what we show for different template types in different contexts has diverged significantly. See https://github.com/alphagov/notifications-utils/commit/6b39c1a for an example of this code moving into utils Depends on and implements: https://github.com/alphagov/notifications-utils/pull/84 The main reason for doing this is to get Paul’s fix for the misaligned CSV columns: https://github.com/alphagov/notifications-utils/pull/87
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
{% macro email_message(
|
||||
subject,
|
||||
body,
|
||||
from_name=None,
|
||||
from_address=None,
|
||||
recipient=None,
|
||||
id=None,
|
||||
show_placeholder_for_recipient=False,
|
||||
show_id=False,
|
||||
expanded=False
|
||||
) %}
|
||||
<div class="email-message">
|
||||
{% if from_name or subject %}
|
||||
<table class="email-message-meta">
|
||||
<tbody>
|
||||
{% if from_name and from_address %}
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<td>
|
||||
{{ from_name }} <{{ from_address }}>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if recipient is not none %}
|
||||
<tr>
|
||||
<th>To</th>
|
||||
<td>
|
||||
{% if show_placeholder_for_recipient %}
|
||||
<span class="placeholder-no-brackets">
|
||||
email address
|
||||
</span>
|
||||
{% else %}
|
||||
{{ recipient }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if subject %}
|
||||
<tr class="email-message-meta">
|
||||
<th>Subject</th>
|
||||
<td>
|
||||
{{ subject }}
|
||||
</td>
|
||||
</div>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
<div class="email-message-body" {% if not expanded %}data-module="expand-collapse" data-max-height="200"{% endif %}>
|
||||
{% if not expanded %}
|
||||
<div class="email-message-body-wrapper">
|
||||
{% endif %}
|
||||
{{ body }}
|
||||
{% if not expanded %}
|
||||
</div>
|
||||
<div class='toggle' tabindex='0'>...<span class='visually-hidden'>show full email</span></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
@@ -1,7 +0,0 @@
|
||||
{% macro letter(
|
||||
body
|
||||
) %}
|
||||
<div class="letter">
|
||||
{{ body }}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
@@ -1,37 +0,0 @@
|
||||
{% macro sms_message(
|
||||
body,
|
||||
recipient=None,
|
||||
id=None,
|
||||
from=None,
|
||||
version=1,
|
||||
updated_at=None,
|
||||
versions_url=None,
|
||||
show_placeholder_for_recipient=False,
|
||||
show_id=False
|
||||
) %}
|
||||
{% if recipient is not none %}
|
||||
<p class="sms-message-recipient">
|
||||
To:
|
||||
{% if show_placeholder_for_recipient %}
|
||||
<span class="placeholder-no-brackets">
|
||||
phone number
|
||||
</span>
|
||||
{% else %}
|
||||
{{ recipient }}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
<div class="sms-message-wrapper{% if input_name %}-with-radio{% endif %}">
|
||||
{% if from %}
|
||||
<span class="sms-message-from">
|
||||
{{ from }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{{ body|nl2br }}
|
||||
</div>
|
||||
{% if show_id %}
|
||||
<p class="sms-message-recipient">
|
||||
Template ID: {{ id }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user