{# Search box region — #954 cycle 4. Renders an htmx-driven search input that hits `/api/fts/?q=…` and swaps the results list under the input on every keystroke (debounced). Each result row shows the entity's `display_field` (or fallback) plus highlighted `` snippets when the SearchSpec opted into `highlight: true`. The endpoint authoritatively applies scope predicates, so what the user sees is always RBAC-filtered. Region context (set by the renderer): - source — entity name being searched (e.g. "Manuscript") - title — region card title - placeholder — search input placeholder text (default: "Search…") - display_field — field to render as the row label (default: "id") Card safety: region emits zero chrome + zero title. The dashboard slot owns both via region_card. #} {% from 'macros/region_wrapper.html' import region_card %} {% set _entity = source %} {% set _placeholder = placeholder | default('Search…') %} {% set _display_field = display_field | default('id') %} {% set _results_id = "dz-search-results-" + (name | default('searchbox')) %} {% call region_card(title) %}
{# Server-rendered initial state: empty / coaching message until the user types. The htmx swap replaces this when the first results arrive. #}
{{ _("Type to search") }}
{% endcall %}