Files
doctate/server/templates/partials/oneliner.html
T
Brummel 75c89c132f Refactor case page template and oneliner rendering
Introduced a new macro `render` in `partials/oneliner.html` to handle
the display of the oneliner for cases. This macro encapsulates the logic
for rendering the oneliner, including states for ready, empty, error,
pending, and generating.

The `case_page.html` and `my_cases.html` templates are updated to use
this new macro. This refactoring centralizes the oneliner rendering
logic, making it more maintainable and consistent across different
views.

Additionally, the `OnelinerDisplay` enum is now used in
`CasePageTemplate` and `MyCasesTemplate` to represent the different
states of the oneliner, improving type safety and clarity.
2026-04-20 14:44:05 +02:00

13 lines
649 B
HTML

{#- Shared 5-state oneliner renderer. Emits the inline content only (no
prefix/suffix), so callers can wrap it in their own context — a
" — " separator in the case list, an <h1> span on the case page. -#}
{% macro render(ol) -%}
{% match ol -%}
{% when OnelinerDisplay::Ready with (t) %}{{ t }}
{%- when OnelinerDisplay::Empty %}<span class="empty">unbenannt</span>
{%- when OnelinerDisplay::Error %}<span class="empty">Fehler</span>
{%- when OnelinerDisplay::Pending %}<span class="pending">transkribiere …</span>
{%- when OnelinerDisplay::Generating %}<span class="pending">generiere Titel …</span>
{%- endmatch %}
{%- endmacro %}