mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-23 11:51:05 -05:00
It’s a bit silly to have email templates expandable if you’re only going to reveal a couple more lines. This commit adds a data attribute which specifies how high (in pixels) the email template can be before it gets truncated. It then changes the script to only truncate emails which are naturally taller than this height. Currently the cut off is at 200px, which is approximately 8 lines of text: `200px / (font-size: 19px * line-height: 1.31) = 8.03`
41 lines
1.1 KiB
HTML
41 lines
1.1 KiB
HTML
{% macro email_message(subject, body, name=None, edit_link=None, from_name=None, from_address=None) %}
|
|
{% if name %}
|
|
<h3 class="email-message-name">
|
|
{% if edit_link %}
|
|
<a href="{{ edit_link }}">{{ name }}</a>
|
|
{% else %}
|
|
{{ name }}
|
|
{% endif %}
|
|
</h3>
|
|
{% endif %}
|
|
<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 subject %}
|
|
<tr class="email-message-meta">
|
|
<th>Subject</th>
|
|
<td>
|
|
{{ subject }}
|
|
</td>
|
|
</div>
|
|
{% endif %}
|
|
</tbody>
|
|
</table>
|
|
{% endif %}
|
|
<div class="email-message-body" data-module="expand-collapse" data-max-height="200">
|
|
<div class="email-message-body-wrapper">
|
|
{{ body|nl2br }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endmacro %}
|