From de94f369a717beb4ce926272476e6fc9cc34f408 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Tue, 24 Jan 2017 17:42:18 +0000 Subject: [PATCH] A bug was reported on where editting a template with a breaking change. The url was not being properly formed, missing the tempalte_id, meaning the back button on the page did not work. This fixes that, includes a check of the url for the back button. --- app/main/views/templates.py | 1 + app/templates/views/templates/breaking-change.html | 2 ++ tests/app/main/views/test_templates.py | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 5fa6be365..a578168a5 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -218,6 +218,7 @@ def edit_service_template(service_id, template_id): 'name': form.name.data, 'subject': subject, 'content': form.template_content.data, + 'id': new_template.id }, column_headings=list(ascii_uppercase[:len(new_template.placeholders) + 1]), example_rows=[ diff --git a/app/templates/views/templates/breaking-change.html b/app/templates/views/templates/breaking-change.html index 835ceff47..6a94248c6 100644 --- a/app/templates/views/templates/breaking-change.html +++ b/app/templates/views/templates/breaking-change.html @@ -29,6 +29,8 @@ + + {{ page_footer( 'Save changes to template', diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 1f1d0a5a9..b6400bd1f 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -279,7 +279,9 @@ def test_should_show_interstitial_when_making_breaking_change( assert response.status_code == 200 page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') assert page.h1.string.strip() == "Confirm changes" - + assert page.find('a', {'class': 'page-footer-back-link'})['href'] == url_for(".edit_service_template", + service_id=service_id, + template_id=template_id) for key, value in { 'name': 'new name', 'subject': 'reminder',