Don’t hide the rename form on delete

It’s weird that this page changes when you click delete – it looks like
you’re going to a different page.

It should feel like you’re on the same page, just with the confirmation
message.

The problem we had before is that the rename form would `POST` to
`…/delete`, which would then delete the template instead of updating
its name.

We can fix this by explicitly setting the `action` attribute on the
rename form to always post to `…/manage`, even if the user is currently
looking at the `…/delete` page.
This commit is contained in:
Chris Hill-Scott
2018-11-20 10:37:33 +00:00
parent ad129e92dd
commit 13a962b6bd
3 changed files with 29 additions and 21 deletions

View File

@@ -406,7 +406,9 @@ def manage_template_folder(service_id, template_folder_id):
def delete_template_folder(service_id, template_folder_id):
if not current_service.has_permission('edit_folders'):
abort(403)
form = TemplateFolderForm()
form = TemplateFolderForm(
name=current_service.get_template_folder(template_folder_id)['name']
)
template_folder_path = current_service.get_template_folder_path(template_folder_id)
template_folder_name = template_folder_path[-1]["name"]
@@ -450,7 +452,6 @@ def delete_template_folder(service_id, template_folder_id):
current_service_id=current_service.id,
template_folder_id=template_folder_id,
template_type="all",
delete_folder=True
)