mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 00:33:58 -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,9 +1,6 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/email-message.html" import email_message %}
|
||||
{% from "components/radios.html" import radio_select %}
|
||||
{% from "components/sms-message.html" import sms_message %}
|
||||
{% from "components/letter.html" import letter %}
|
||||
{% from "components/table.html" import list_table, field, text_field, index_field, hidden_field_heading %}
|
||||
{% from "components/file-upload.html" import file_upload %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
@@ -130,28 +127,7 @@
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if 'email' == template.template_type %}
|
||||
{{ email_message(
|
||||
template.formatted_subject_as_markup if errors else template.replaced_subject,
|
||||
template.formatted_as_markup if errors else template.replaced|safe,
|
||||
from_address='{}@notifications.service.gov.uk'.format(current_service.email_from),
|
||||
from_name=current_service.name,
|
||||
recipient=first_recipient,
|
||||
show_placeholder_for_recipient=errors
|
||||
)}}
|
||||
{% elif 'sms' == template.template_type %}
|
||||
<div class="grid-row">
|
||||
<div class="column-two-thirds">
|
||||
{{ sms_message(
|
||||
template.formatted_as_markup if errors else template.replaced|safe,
|
||||
recipient=first_recipient,
|
||||
show_placeholder_for_recipient=errors
|
||||
)}}
|
||||
</div>
|
||||
</div>
|
||||
{% elif 'letter' == template.template_type %}
|
||||
{{ letter(template.formatted_as_markup if errors else template.replaced|safe) }}
|
||||
{% endif %}
|
||||
{{ template.rendered }}
|
||||
|
||||
{% if errors %}
|
||||
{% if request.args.from_test %}
|
||||
|
||||
Reference in New Issue
Block a user