Files
notifications-admin/app/templates/components/message-count-label.html
Chris Hill-Scott 6c4b6774aa Label folders to show what’s in them
It feels like a solid reckon that knowing what’s in a folder before you
click on it will help you navigate around.

However, what do you show in a folder if you’re filtering by template
type? We think that:
- if you’re not filtering you should see all folders, even empty ones
- if you’re filtering you should only see folders that will get you to
  relevant templates

This matches what happens when you filter templates, we don’t ‘grey out’
the non-email templates, we hide them completely.

The logic then extends to how we describe the contents of a folder, ie
we won’t count its subfolders if they don’t contain templates of the
type we’re looking for. This means that however you see the folder
described (eg ‘3 templates, 1 folder’) will match what you see when you
click into it.
2018-11-13 11:10:21 +00:00

81 lines
1.8 KiB
HTML

{% macro message_count_label(count, template_type, suffix='sent') -%}
{% if template_type == None %}
{%- if count == 1 -%}
message
{%- else -%}
messages
{%- endif -%}
{% endif %}
{%- if template_type == 'sms' -%}
{%- if count == 1 -%}
text message
{%- else -%}
text messages
{%- endif -%}
{%- elif template_type == 'email' -%}
{%- if count == 1 -%}
email
{%- else -%}
emails
{%- endif -%}
{%- elif template_type == 'letter' -%}
{%- if count == 1 -%}
letter
{%- else -%}
letters
{%- endif -%}
{%- endif %} {{ suffix }}
{%- endmacro %}
{% macro recipient_count_label(count, template_type) -%}
{% if template_type == None %}
{%- if count == 1 -%}
recipient
{%- else -%}
recipients
{%- endif -%}
{% endif %}
{%- if template_type == 'sms' -%}
{%- if count == 1 -%}
phone number
{%- else -%}
phone numbers
{%- endif -%}
{%- elif template_type == 'email' -%}
{%- if count == 1 -%}
email address
{%- else -%}
email addresses
{%- endif -%}
{%- elif template_type == 'letter' -%}
{%- if count == 1 -%}
address
{%- else -%}
addresses
{%- endif -%}
{%- endif %}
{%- endmacro %}
{% macro folder_contents_count(number_of_folders, number_of_templates) %}
{% if number_of_folders == number_of_templates == 0 %}
Empty
{% endif %}
{% if number_of_templates == 1 %}
{{ number_of_templates }} template
{%- elif number_of_templates > 1 -%}
{{ number_of_templates }} templates
{%- endif -%}
{%- if number_of_folders and number_of_templates %}, {% endif -%}
{%- if number_of_folders == 1 -%}
{{ number_of_folders }} folder
{%- elif number_of_folders > 1 -%}
{{ number_of_folders }} folders
{% endif %}
{%- endmacro %}