{% macro status_pill(value) -%}
{{ value | replace("_", " ") }}
{%- endmacro %}
{% macro media_pill(media_type) -%}
{{ media_type.display_name }}
{%- endmacro %}
{% macro cover_url(raw, version=None) -%}
{#- ``version`` is appended as &v=<...> when given, busting the browser cache
after a metadata refresh. Pass ``work.updated_at`` (or its timestamp). -#}
/ui/covers?url={{ raw | urlencode }}{% if version %}&v={{ version | string | urlencode }}{% endif %}
{%- endmacro %}
{% macro availability_pill(status) -%}
{% if status == 'available' %}Available
{%- elif status == 'checked_out' %}Checked Out
{%- endif %}
{%- endmacro %}
{% macro loan_pill(item) -%}
{% if not item.is_loanable %}
{{ (item.loan_restriction_reason or 'non-loanable') | replace("_", " ") }}
{% endif %}
{%- endmacro %}