{# Shared filter-bar element. Rendered both inline in the toolbar and standalone in filters.html, and re-rendered on its own for HTMX out-of-band swaps so that faceted option lists can refresh against the current filter/search subset. Context vars: fb — the GridViewFilters block (schema/state/auto_apply/facets/fragment_*) host — render host (translate) fb_search — optional {param, value} → emits a hidden search input (toolbar use) fb_oob — when truthy, marks the element for HTMX outerHTML out-of-band swap #}
{% if fb_search %} {% endif %} {% macro render_option(option, selected, depth=0) -%} {% for child in option.children %}{{ render_option(child, selected, depth + 1) }}{% endfor %} {%- endmacro %} {% for filter in fb.schema %} {% set selected = fb.state.values.get(filter.param, ()) if fb.state else () %} {% if filter.type == 'grouped_select' %}
{{ filter.label | e }} {% for group in filter.options if group.children %} {% endfor %}
{% elif filter.type in ('select', 'multiselect', 'set', 'number_range', 'date_range') %}
{% if filter.select_all %} {% endif %} {% for opt in filter.options %}{{ render_option(opt, selected) }}{% endfor %}
{% elif filter.type == 'boolean' %} {% else %} {% set selected_value = selected if selected is string or selected is number else '' %} {% endif %} {% endfor %}