Label folders to show what’s in them

It feels like a solid reckon that knowing what’s in a folder before you
click on it will help you navigate around.

However, what do you show in a folder if you’re filtering by template
type? We think that:
- if you’re not filtering you should see all folders, even empty ones
- if you’re filtering you should only see folders that will get you to
  relevant templates

This matches what happens when you filter templates, we don’t ‘grey out’
the non-email templates, we hide them completely.

The logic then extends to how we describe the contents of a folder, ie
we won’t count its subfolders if they don’t contain templates of the
type we’re looking for. This means that however you see the folder
described (eg ‘3 templates, 1 folder’) will match what you see when you
click into it.
This commit is contained in:
Chris Hill-Scott
2018-11-12 14:43:47 +00:00
parent 7fc5bf41b7
commit 6c4b6774aa
3 changed files with 53 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
{% from "components/checkbox.html" import unlabelled_checkbox %}
{% from "components/message-count-label.html" import folder_contents_count %}
<nav id=template-list>
{% for template_folder in template_folders %}
@@ -15,7 +16,12 @@
{{ template_folder.name }}
</a>
</h2>
<p class="message-type">Folder containing {{ template_count }} template{% if template_count != 1 %}s{% endif %}</p>
<p class="message-type">
{{ folder_contents_count(
current_service.get_template_folders(template_folder.id, template_type)|length,
current_service.get_templates(template_type, template_folder.id)|length,
) }}
</p>
</div>
{% endfor %}
{% for template in templates %}