mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-03 21:21:14 -04:00
Refine empty folder message
If the folder is completely empty, always say ‘This folder is empty’, so we don’t suggest that you can click around and find other things. If the current view is filtered, but there are templates available in other filters, say ‘There are no text message templates in this folder’ to make it clear why you can’t see anything.
This commit is contained in:
@@ -128,6 +128,7 @@ def choose_template(service_id, template_type='all', template_folder_id=None):
|
||||
current_template_folder_id=template_folder_id,
|
||||
can_manage_folders=can_manage_folders(),
|
||||
template_folder_path=current_service.get_template_folder_path(template_folder_id),
|
||||
template_folder_has_contents=current_service.get_template_folders_and_templates('all', template_folder_id),
|
||||
template_folders=current_service.get_template_folders(template_type, template_folder_id),
|
||||
templates=templates_on_page,
|
||||
show_search_box=(len(templates_on_page) > 7),
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
{% 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
|
||||
{% if template_folder_has_contents %}
|
||||
There are no {{ message_count_label(1, template_type, suffix='') }} templates in this folder
|
||||
{% else %}
|
||||
This folder is empty
|
||||
{% endif %}
|
||||
</p>
|
||||
{% else %}
|
||||
<nav id=template-list>
|
||||
|
||||
@@ -81,7 +81,8 @@
|
||||
templates=templates,
|
||||
template_folders=template_folders,
|
||||
service_has_templates_or_folders=(current_service.has_templates or current_service.has_folders),
|
||||
template_type=template_type
|
||||
template_type=template_type,
|
||||
template_folder_has_contents=template_folder_has_contents
|
||||
%}
|
||||
{% include 'views/templates/_template_list.html' %}
|
||||
{% endwith %}
|
||||
@@ -94,7 +95,8 @@
|
||||
templates=templates,
|
||||
template_folders=template_folders,
|
||||
service_has_templates_or_folders=(current_service.has_templates or current_service.has_folders),
|
||||
template_type=template_type
|
||||
template_type=template_type,
|
||||
template_folder_has_contents=template_folder_has_contents
|
||||
%}
|
||||
{% include 'views/templates/_template_list.html' %}
|
||||
{% endwith %}
|
||||
|
||||
@@ -171,7 +171,7 @@ def test_post_add_template_folder_page(client_request, service_one, mocker, pare
|
||||
{'template_type': 'email', 'template_folder_id': PARENT_FOLDER_ID},
|
||||
['All', 'Text message', 'Letter'],
|
||||
[],
|
||||
'No email templates in this folder',
|
||||
'There are no email templates in this folder',
|
||||
),
|
||||
(
|
||||
'folder_one_one – folder_one – service one – GOV.UK Notify',
|
||||
@@ -203,7 +203,16 @@ def test_post_add_template_folder_page(client_request, service_one, mocker, pare
|
||||
{'template_folder_id': FOLDER_TWO_ID},
|
||||
['Text message', 'Email', 'Letter'],
|
||||
[],
|
||||
'No templates in this folder',
|
||||
'This folder is empty',
|
||||
),
|
||||
(
|
||||
'folder_two – Templates – service one – GOV.UK Notify',
|
||||
'Templates / folder_two',
|
||||
{'template_type': 'sms'},
|
||||
{'template_folder_id': FOLDER_TWO_ID, 'template_type': 'sms'},
|
||||
['All', 'Email', 'Letter'],
|
||||
[],
|
||||
'This folder is empty',
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user