mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-27 10:50:30 -04:00
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).
This commit is contained in:
@@ -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 %} <span class="message-name-separator"></span> {% endif -%}
|
||||
{{- format_item_name(part, separators) -}}
|
||||
{%- if not loop.last -%}
|
||||
{%- if separators %}
|
||||
<span class="message-name-separator"></span>{%- else %} {% endif -%}
|
||||
{% endif -%}
|
||||
{%- endfor -%}
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
@@ -33,17 +36,20 @@
|
||||
{% endfor %}
|
||||
{% if item.is_folder %}
|
||||
<a href="{{ url_for('.choose_template', service_id=current_service.id, template_type=template_type, template_folder_id=item.id) }}" class="govuk-link govuk-link--no-visited-state template-list-folder">
|
||||
<span class="live-search-relevant">{{ format_item_name(item.name) }}</span>
|
||||
<span class="live-search-relevant">{{- format_item_name(item.name) -}}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.id) }}" class="govuk-link govuk-link--no-visited-state template-list-template">
|
||||
<span class="live-search-relevant">{{ format_item_name(item.name) }}</span>
|
||||
<span class="live-search-relevant">{{- format_item_name(item.name) -}}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endset %}
|
||||
|
||||
{% set label_content %}
|
||||
<span class="govuk-visually-hidden">{{ format_item_name(item.name) }}</span>
|
||||
<span class="govuk-visually-hidden">
|
||||
{%- for ancestor in item.ancestors %}{{ format_item_name(ancestor.name, separators=False) }} {% endfor -%}
|
||||
{{ format_item_name(item.name, separators=False) -}}
|
||||
</span>
|
||||
{% endset %}
|
||||
|
||||
{% set item_meta %}
|
||||
|
||||
Reference in New Issue
Block a user