mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Make the empty folder state more useful
Currently if there’s nothing in a folder you just get an empty page. This looks a bit broken, or like the page hasn’t finished loading. This commit adds a message to the page to show that it’s intentionally blank. The message is contextual based on type of template, because there might be templates in the current folder, even if you can’t see them at the moment (because you’re filtering).
This commit is contained in:
@@ -1,44 +1,50 @@
|
||||
{% from "components/checkbox.html" import unlabelled_checkbox %}
|
||||
{% from "components/message-count-label.html" import folder_contents_count %}
|
||||
{% from "components/message-count-label.html" import folder_contents_count, message_count_label %}
|
||||
|
||||
<nav id=template-list>
|
||||
{% for template_folder in template_folders %}
|
||||
<div class="template-list-item {% if can_manage_folders %}template-list-item-with-checkbox{% endif %}">
|
||||
{% if can_manage_folders %}
|
||||
{{ unlabelled_checkbox(
|
||||
id='templates-or-folder-{}'.format(template_folder.id),
|
||||
name='templates_and_folders',
|
||||
value=template_folder.id,
|
||||
) }}
|
||||
{% endif %}
|
||||
<h2 class="message-name template-list-folder">
|
||||
<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>
|
||||
</h2>
|
||||
<p class="message-type">
|
||||
{{ folder_contents_count(
|
||||
current_service.get_template_folders(template_type, template_folder.id)|length,
|
||||
current_service.get_templates(template_type, template_folder.id)|length,
|
||||
) }}
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% for template in templates %}
|
||||
<div class="template-list-item {% if can_manage_folders %}template-list-item-with-checkbox{% endif %}">
|
||||
{% if can_manage_folders %}
|
||||
{{ unlabelled_checkbox(
|
||||
id='templates-or-folder-{}'.format(template.id),
|
||||
name='templates_and_folders',
|
||||
value=template.id,
|
||||
) }}
|
||||
{% endif %}
|
||||
<h2 class="message-name">
|
||||
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=template.id) }}">{{ template.name }}</a>
|
||||
</h2>
|
||||
<p class="message-type">
|
||||
{{ message_count_label(1, template.template_type, suffix='')|capitalize }} template
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
{% if service_has_templates_or_folders and not templates and not template_folders %}
|
||||
<p class="template-list-empty">
|
||||
No {{ message_count_label(1, template_type, suffix='') }} templates in this folder
|
||||
</p>
|
||||
{% else %}
|
||||
<nav id=template-list>
|
||||
{% for template_folder in template_folders %}
|
||||
<div class="template-list-item {% if can_manage_folders %}template-list-item-with-checkbox{% endif %}">
|
||||
{% if can_manage_folders %}
|
||||
{{ unlabelled_checkbox(
|
||||
id='templates-or-folder-{}'.format(template_folder.id),
|
||||
name='templates_and_folders',
|
||||
value=template_folder.id,
|
||||
) }}
|
||||
{% endif %}
|
||||
<h2 class="message-name template-list-folder">
|
||||
<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>
|
||||
</h2>
|
||||
<p class="message-type">
|
||||
{{ folder_contents_count(
|
||||
current_service.get_template_folders(template_type, template_folder.id)|length,
|
||||
current_service.get_templates(template_type, template_folder.id)|length,
|
||||
) }}
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% for template in templates %}
|
||||
<div class="template-list-item {% if can_manage_folders %}template-list-item-with-checkbox{% endif %}">
|
||||
{% if can_manage_folders %}
|
||||
{{ unlabelled_checkbox(
|
||||
id='templates-or-folder-{}'.format(template.id),
|
||||
name='templates_and_folders',
|
||||
value=template.id,
|
||||
) }}
|
||||
{% endif %}
|
||||
<h2 class="message-name">
|
||||
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=template.id) }}">{{ template.name }}</a>
|
||||
</h2>
|
||||
<p class="message-type">
|
||||
{{ message_count_label(1, template.template_type, suffix='')|capitalize }} template
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
@@ -77,7 +77,12 @@
|
||||
|
||||
{% if can_manage_folders %}
|
||||
<form method="post">
|
||||
{% with templates=templates, template_folders=template_folders %}
|
||||
{% with
|
||||
templates=templates,
|
||||
template_folders=template_folders,
|
||||
service_has_templates_or_folders=(current_service.has_templates or current_service.has_folders),
|
||||
template_type=template_type
|
||||
%}
|
||||
{% include 'views/templates/_template_list.html' %}
|
||||
{% endwith %}
|
||||
{% with templates=templates, template_folders=template_folders, templates_and_folders_form=templates_and_folders_form %}
|
||||
@@ -85,7 +90,12 @@
|
||||
{% endwith %}
|
||||
</form>
|
||||
{% else %}
|
||||
{% with templates=templates, template_folders=template_folders %}
|
||||
{% with
|
||||
templates=templates,
|
||||
template_folders=template_folders,
|
||||
service_has_templates_or_folders=(current_service.has_templates or current_service.has_folders),
|
||||
template_type=template_type
|
||||
%}
|
||||
{% include 'views/templates/_template_list.html' %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user