From d512f330cd6c0f573218377b5d0e371459c4eb12 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Tue, 31 Jul 2018 16:20:10 +0100 Subject: [PATCH] =?UTF-8?q?Edit,=20don=E2=80=99t=20duplicate,=20existing?= =?UTF-8?q?=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main/views/templates.py | 6 +++++- app/templates/views/edit-email-template.html | 5 +---- app/templates/views/edit-letter-template.html | 5 +---- app/templates/views/edit-sms-template.html | 5 +---- tests/app/main/views/test_templates.py | 5 ----- 5 files changed, 8 insertions(+), 18 deletions(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index dc23b97c2..732023f65 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -287,6 +287,10 @@ def copy_template(service_id, template_id): request.args.get('from_service'), str(template_id), )['data'] + + if request.method == 'POST': + return add_service_template(service_id, template['template_type']) + template['template_content'] = template['content'] template['name'] = 'Copy of ‘{}’'.format(template['name']) form = form_objects[template['template_type']](**template) @@ -458,7 +462,7 @@ def edit_service_template(service_id, template_id): form=form, template_id=template_id, template_type=template['template_type'], - heading_action='Edit' + heading_action='Edit', ) diff --git a/app/templates/views/edit-email-template.html b/app/templates/views/edit-email-template.html index 6603d79cf..bc6010a29 100644 --- a/app/templates/views/edit-email-template.html +++ b/app/templates/views/edit-email-template.html @@ -13,10 +13,7 @@ {{ heading_action }} email template -
+
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this', rows=10) }} diff --git a/app/templates/views/edit-letter-template.html b/app/templates/views/edit-letter-template.html index 0fa49c587..804e40339 100644 --- a/app/templates/views/edit-letter-template.html +++ b/app/templates/views/edit-letter-template.html @@ -12,10 +12,7 @@ {{ heading_action }} letter template - +
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this', rows=10) }} diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index 63c929b8e..e7578aee0 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -13,10 +13,7 @@ {{ heading_action }} text message template - +
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this') }} diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 0cead3cb2..16dc6d4bb 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -477,11 +477,6 @@ def test_load_edit_template_with_copy_of_template( ) assert page.select_one('form')['method'] == 'post' - assert page.select_one('form')['action'] == url_for( - 'main.add_service_template', - service_id=SERVICE_ONE_ID, - template_type='email', - ) assert page.select_one('input')['value'] == ( 'Copy of ‘Two week reminder’'