Create new folders inside the current folder

When adding a new folder it is created inside the currently active
one. The user is returned to the previously active folder page,
which shows the added folder.

This adds a new route to the add template/folder views. Thankfully,
`url_for` recognizes when `template_folder_id` is `None` and will use
the URL without `/folders/...`, so users without folder permissions
should be unaffected by this change.
This commit is contained in:
Alexey Bezhan
2018-11-06 13:06:35 +00:00
parent 9e5ca45d38
commit aaca537792
3 changed files with 29 additions and 10 deletions

View File

@@ -64,7 +64,7 @@
</div>
{% if current_user.has_permissions('manage_templates') %}
<div class="column-one-third">
<a href="{{ url_for('.add_template_by_type', service_id=current_service.id) }}" class="button align-with-heading">Add new template</a>
<a href="{{ url_for('.add_template_by_type', service_id=current_service.id, template_folder_id=current_template_folder_id) }}" class="button align-with-heading">Add new template</a>
</div>
{% endif %}
</div>