Consolidate page templates for emails + texts

Use one page template for each of:
- choosing a message template
- adding recipients
- checking an email message
- looking at a job

This commit consolidates the two templates into one, and adds logic to show
the SMS message pattern or the email message pattern depending on the type of
template.

It also gives email templates a bit more width, because the body and the from
address tend to be quite long.
This commit is contained in:
Chris Hill-Scott
2016-02-25 16:37:39 +00:00
parent 2c4119e2e0
commit a51d92c87a
9 changed files with 80 additions and 90 deletions

View File

@@ -1,18 +0,0 @@
{% extends "withnav_template.html" %}
{% block page_title %}
Send email GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Send email</h1>
<p>This page will be where we check the email messages we're about to send</p>
<p>
<a class="button" href="dashboard" role="button">Send email messages</a>
</p>
{% endblock %}

View File

@@ -1,4 +1,5 @@
{% extends "withnav_template.html" %}
{% from "components/email-message.html" import email_message %}
{% from "components/sms-message.html" import sms_message %}
{% from "components/table.html" import list_table, field %}
{% from "components/placeholder.html" import placeholder %}
@@ -6,7 +7,7 @@
{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
Check and confirm GOV.UK Notify
{{ "Check and confirm" if upload_result.valid else page_heading }} GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
@@ -25,18 +26,23 @@
{% endif %}
<h1 class="heading-large">
{{ "Check and confirm" if upload_result.valid else "Send text messages" }}
{{ "Check and confirm" if upload_result.valid else page_heading }}
</h1>
<div class="grid-row">
<div class="column-two-thirds">
{% if template.missing_data or template.additional_data %}
{{ sms_message(template.formatted_as_markup)}}
{% else %}
{{ sms_message(template.replaced)}}
{% endif %}
{% if 'email' == template.template_type %}
{{ email_message(
template.subject,
template,
from_address='{}@notifications.service.gov.uk'.format(service.email_from),
from_name=service.name
)}}
{% elif 'sms' == template.template_type %}
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(template)}}
</div>
</div>
</div>
{% endif %}
{% if upload_result.valid %}
<form method="post" enctype="multipart/form-data">
@@ -53,7 +59,7 @@
caption=original_file_name,
field_headings=column_headers
) %}
{% if item.to|valid_phone_number %}
{% if item.to or ''|valid_phone_number %}
{% call field() %}
{{ item.to }}
{% endcall %}

View File

@@ -1,36 +0,0 @@
{% extends "withnav_template.html" %}
{% from "components/email-message.html" import email_message %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/textbox.html" import textbox %}
{% block page_title %}
Send emails GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Send emails</h1>
<form method="POST" enctype="multipart/form-data">
{% if templates %}
<div class="grid-row">
{% for template in templates %}
<div class="column-two-thirds">
{{ email_message(template.subject, template.formatted_as_markup, name=template.name) }}
</div>
<div class="column-one-third">
<div class="sms-message-use-links">
<a href="{{ url_for(".edit_service_template", service_id=service_id, template_id=template.id) }}">Edit template</a>
</div>
</div>
{% endfor %}
</div>
{% endif %}
<p>
<a href="{{ url_for('.add_service_template', service_id=service_id, template_type='email') }}" class="button">Add a new template</a>
</p>
</form>
{% endblock %}

View File

@@ -1,15 +1,16 @@
{% extends "withnav_template.html" %}
{% from "components/email-message.html" import email_message %}
{% from "components/sms-message.html" import sms_message %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/textbox.html" import textbox %}
{% block page_title %}
Send text messages GOV.UK Notify
{{ page_heading }} GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Send text messages</h1>
<h1 class="heading-large">{{ page_heading }}</h1>
<form method="POST" enctype="multipart/form-data">
@@ -26,7 +27,15 @@
<div class="grid-row">
{% for template in templates %}
<div class="column-two-thirds">
{{ sms_message(template.formatted_as_markup, name=template.name) }}
{% if 'email' == template_type %}
{{ email_message(
template.subject,
template.formatted_as_markup,
name=template.name
) }}
{% elif 'sms' == template_type %}
{{ sms_message(template.formatted_as_markup, name=template.name) }}
{% endif %}
</div>
<div class="column-one-third">
<div class="sms-message-use-links">
@@ -40,7 +49,7 @@
{% endif %}
<p>
<a href="{{ url_for('.add_service_template', service_id=service_id, template_type='sms') }}" class="button">Add a new template</a>
<a href="{{ url_for('.add_service_template', service_id=service_id, template_type=template_type) }}" class="button">Add a new template</a>
</p>
</form>

View File

@@ -14,13 +14,22 @@
{{ uploaded_file_name }}
</h1>
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(
template.formatted_as_markup,
)}}
{% if 'sms' == template.template_type %}
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(
template,
)}}
</div>
</div>
</div>
{% elif 'email' == template.template_type %}
{{ email_message(
template.subject,
template,
from_address='{}@notifications.service.gov.uk'.format(service.email_from),
from_name=service.name
)}}
{% endif %}
<p class='heading-small'>
Started {{ uploaded_file_time|format_datetime }}

View File

@@ -13,18 +13,23 @@
<h1 class="heading-large">Add recipients</h1>
{% if 'sms' == template.template_type %}
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(template) }}
</div>
</div>
{% elif 'email' == template.template_type %}
{{ email_message(
template.subject,
template,
from_address='{}@notifications.service.gov.uk'.format(service.email_from),
from_name=service.name
) }}
{% endif %}
<div class="grid-row">
<div class="column-two-thirds">
{% if 'sms' == template.template_type %}
{{ sms_message(template.formatted_as_markup) }}
{% elif 'email' == template.template_type %}
{{ email_message(
template.subject,
template.formatted_as_markup,
from_address='{}@notifications.service.gov.uk'.format(service.email_from),
from_name=service.name
) }}
{% endif %}
{{ banner(
'You can upload real data, but well only send to your mobile number until you <a href="{}">request to go live</a>'.format(
url_for('.service_request_to_go_live', service_id=service_id)