Link template folders to their contents

Clicking on template folder navigates to a page that displays that
folder's contents.

This reuses the existing choose template view by adding a filter
based on optional `template_folder_id` argument.

Service model methods are rewritten to match `all_templates` and
`get_template`. New `get_template_folder_path` method returns a
list of folders (from root to the current one) that the selected
folder is nested inside.
This commit is contained in:
Alexey Bezhan
2018-11-05 16:25:19 +00:00
parent 29bed8ba55
commit 20abe96fc9
4 changed files with 32 additions and 11 deletions

View File

@@ -13,7 +13,7 @@
{% block maincolumn_content %}
{% if not templates %}
{% if (not templates) and (not template_folder_path) %}
<h1 class="heading-large">{{ page_title }}</h1>
{% if current_user.has_permissions('manage_templates') %}
@@ -62,9 +62,9 @@
{% for template_folder in template_folders %}
<div class="column-whole">
<h2 class="message-name">
{# <a href="{{ url_for('.view_template_folder', service_id=current_service.id, template_folder_id=template_folder.id) }}"> #}
<a href="{{ url_for('.choose_template', service_id=current_service.id, template_type=template_type, template_folder_id=template_folder.id) }}">
{{ template_folder.name }}
{# </a> #}
</a>
</h2>
<p class="message-type">Folder containing {{ template_count }} template{% if template_count != 1 %}s{% endif %}</p>
</div>