{% extends "base.html" %}
{% block title %}{{ spec.label }}{% endblock %}
{% block content %}
{% set hue = groups.index(spec.group) % 6 if spec.group in groups else 0 %}
{{ spec.group }}
{{ spec.label }}
{% if spec.searchable or spec.exact_searchable or text_filters %}
{% endif %}
{% if spec.renders("create") %}
New
{% endif %}
{% if spec.renders("export") %}
Export CSV
{% endif %}
{% if facets or range_filters %}
{% for name, choices in facets.items() %}
{% set chosen = view.selected(name) %}
{{ name }}
{# A segmented control: one object, the selected values filled, each segment
carrying how many rows it would leave. Several may be on at once, which
widens the filter rather than replacing it. #}
All
{{ choices | sum(attribute="count") }}
{% for choice in choices %}
{% set on = view.has(name, choice.value) %}
{% if choice.empty and not on %}
{# Nothing to select: text rather than a link, so it holds its place in the
control without offering an empty result. #}
{{ choice.value }}
0
{% else %}
{{ choice.value }}
{{ choice.count }}
{% endif %}
{% endfor %}
{% endfor %}
{% for name in range_filters %}
{% set bounds = view.bounds_of(name) %}
{% set matched = namespace(found=false) %}
{{ name }}
{# The same segmented language as the value filters, because it answers the
same kind of question. The spans a reader actually asks for are one click;
anything else opens the two fields. #}
All
{% for preset in range_presets %}
{% if preset.matches(bounds) %}{% set matched.found = true %}{% endif %}
{{ preset.label }}
{% endfor %}
{# Open already when the current range is not one of the presets, so a
custom span is never hidden behind a closed disclosure. #}
Custom
{% endfor %}
{% endif %}
{% if spec.exact_searchable %}
{{ spec.exact_searchable | join(", ") }} match in full only
{% endif %}
{% if spec.selectable %}{% include "_bulk.html" %}{% endif %}