Go back to template after editing contact details

Users who go to edit the contact details for a letter from the template
page get very confused when they click save and are dumped on the
settings page. It doesn’t match the way editing other parts of
letter works, and you can’t see an accurate preview of the changes from
the settings page.

So this commit changes the flow to go from the _edit contact details_
page back to the _view template_ page when the user has got there by
clicking the blue _Edit_ button on the _view template_ page.
This commit is contained in:
Chris Hill-Scott
2017-04-03 09:54:03 +01:00
parent b5127967fe
commit 1f278bdd07
3 changed files with 30 additions and 1 deletions

View File

@@ -275,6 +275,10 @@ def service_set_letter_contact_block(service_id):
current_service['id'],
letter_contact_block=form.letter_contact_block.data.replace('\r', '') or None
)
if request.args.get('from_template'):
return redirect(
url_for('.view_template', service_id=service_id, template_id=request.args.get('from_template'))
)
return redirect(url_for('.service_settings', service_id=service_id))
return render_template(
'views/service-settings/set-letter-contact-block.html',