From 67c27fff8c3526625c3eb93a79b83f5fa6e34709 Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Tue, 9 Jun 2020 16:36:52 +0100 Subject: [PATCH] Make template-list checkbox label text match link The checkboxes need an accessible name that identifies the folder/template and this needs to include their full path to avoid duplication. There's a lot of debate about how to write out breadcrumb/path syntax so this just puts all the words together under the assumption that the folder naming will describe the path (and to introduce as little extra semantics as possible to start with). --- .../views/templates/_template_list.html | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/templates/views/templates/_template_list.html b/app/templates/views/templates/_template_list.html index 0c7f4125c..f17fcfb07 100644 --- a/app/templates/views/templates/_template_list.html +++ b/app/templates/views/templates/_template_list.html @@ -1,12 +1,15 @@ {% from "components/message-count-label.html" import folder_contents_count, message_count_label %} -{% macro format_item_name(name) -%} +{% macro format_item_name(name, separators=True) -%} {%- if name is string -%} {{- name -}} {%- else -%} {%- for part in name -%} - {{- format_item_name(part) -}} - {%- if not loop.last %} {% endif -%} + {{- format_item_name(part, separators) -}} + {%- if not loop.last -%} + {%- if separators %} + {%- else %} {% endif -%} + {% endif -%} {%- endfor -%} {% endif %} {%- endmacro %} @@ -33,17 +36,20 @@ {% endfor %} {% if item.is_folder %} - {{ format_item_name(item.name) }} + {{- format_item_name(item.name) -}} {% else %} - {{ format_item_name(item.name) }} + {{- format_item_name(item.name) -}} {% endif %} {% endset %} {% set label_content %} - {{ format_item_name(item.name) }} + + {%- for ancestor in item.ancestors %}{{ format_item_name(ancestor.name, separators=False) }} {% endfor -%} + {{ format_item_name(item.name, separators=False) -}} + {% endset %} {% set item_meta %}