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:
Chris Hill-Scott
2016-02-22 14:45:13 +00:00
parent 8247f3d568
commit c6de605311
14 changed files with 160 additions and 107 deletions

View File

@@ -4,12 +4,12 @@ from app.utils import BrowsableItem
from notifications_python_client.errors import HTTPError
def insert_service_template(name, content, service_id):
def insert_service_template(name, content, service_id, subject=None):
return notifications_api_client.create_service_template(
name, 'sms', content, service_id)
name, 'sms' if subject is None else 'email', content, service_id, subject)
def update_service_template(id_, name, content, service_id):
def update_service_template(id_, name, content, service_id, subject=None):
return notifications_api_client.update_service_template(
id_, name, 'sms', content, service_id)