mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Add basic flow for adding email _or_ sms templates
Templates now have: - a type (email or sms) - a subject (if they are email templates) We don’t want two completely separate view files for email and SMS, because they would have an enormous amount of repetition. So this commit adds - different templates for SMS and email templates - different form objects for SMS and email templates …and wires them up.
This commit is contained in:
38
app/templates/views/choose-email-template.html
Normal file
38
app/templates/views/choose-email-template.html
Normal file
@@ -0,0 +1,38 @@
|
||||
{% 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(".send_sms", service_id=service_id, template_id=template.id) }}">Add recipients</a>
|
||||
<a href="{{ url_for(".send_sms_to_self", service_id=service_id, template_id=template.id) }}">Send yourself a test</a>
|
||||
<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='sms') }}" class="button">Add a new template</a>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
{% endblock %}
|
||||
@@ -40,7 +40,7 @@
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
<a href="{{ url_for('.add_service_template', service_id=service_id) }}" class="button">Add a new template</a>
|
||||
<a href="{{ url_for('.add_service_template', service_id=service_id, template_type='sms') }}" class="button">Add a new template</a>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<h1 class="heading-large">{{ h1 }}</h1>
|
||||
<h1 class="heading-large">Edit email template</h1>
|
||||
|
||||
<form method="post">
|
||||
<div class="grid-row">
|
||||
<div class="column-two-thirds">
|
||||
{{ textbox(form.name, width='1-1') }}
|
||||
{% if 'email' == template_type %}
|
||||
{{ textbox(form.subject, width='1-1') }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-row">
|
||||
@@ -31,7 +34,7 @@
|
||||
'Save',
|
||||
delete_link=url_for('.delete_service_template', service_id=service_id, template_id=template_id) if template_id or None,
|
||||
delete_link_text='Delete this template',
|
||||
back_link=url_for('.choose_sms_template', service_id=service_id),
|
||||
back_link=url_for('.choose_template', template_type=template_type, service_id=service_id),
|
||||
back_link_text='Cancel'
|
||||
) }}
|
||||
</form>
|
||||
43
app/templates/views/edit-sms-template.html
Normal file
43
app/templates/views/edit-sms-template.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
{% block page_title %}
|
||||
{{ h1 }} – GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<h1 class="heading-large">Edit text message template</h1>
|
||||
|
||||
<form method="post">
|
||||
<div class="grid-row">
|
||||
<div class="column-two-thirds">
|
||||
{{ textbox(form.name, width='1-1') }}
|
||||
{% if 'email' == template_type %}
|
||||
{{ textbox(form.subject, width='1-1') }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-row">
|
||||
<div class="column-two-thirds">
|
||||
{{ textbox(form.template_content, highlight_tags=True, width='1-1') }}
|
||||
</div>
|
||||
<div class="column-one-third">
|
||||
<label for='template_content' class='edit-template-placeholder-hint'>
|
||||
Add placeholders using double brackets, eg Your thing
|
||||
is due on ((date))
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{{ page_footer(
|
||||
'Save',
|
||||
delete_link=url_for('.delete_service_template', service_id=service_id, template_id=template_id) if template_id or None,
|
||||
delete_link_text='Delete this template',
|
||||
back_link=url_for('.choose_template', service_id=service_id, template_type=template_type),
|
||||
back_link_text='Cancel'
|
||||
) }}
|
||||
</form>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,17 +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 construct email messages</p>
|
||||
|
||||
<p>
|
||||
<a class="button" href="check-email" role="button">Continue</a>
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user