From 4bb7519d9ef41112ba177c5a33b606656fc1f37b Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 20 Nov 2018 12:13:50 +0000 Subject: [PATCH] Refine empty folder message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- app/main/views/templates.py | 1 + app/templates/views/templates/_template_list.html | 6 +++++- app/templates/views/templates/choose.html | 6 ++++-- tests/app/main/views/test_template_folders.py | 13 +++++++++++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index c11231006..7e4164a9b 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -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), diff --git a/app/templates/views/templates/_template_list.html b/app/templates/views/templates/_template_list.html index cf41d3d31..3c1cb7555 100644 --- a/app/templates/views/templates/_template_list.html +++ b/app/templates/views/templates/_template_list.html @@ -3,7 +3,11 @@ {% if service_has_templates_or_folders and not templates and not template_folders %}

- 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 %}

{% else %}