{% extends "crud/tab_view.html" %} {% from 'crud/_macros.html' import shown, add_label, sort_header, keep_sort, file_display with context %} {% from 'crud/_actions.html' import action_control %} {% block tab_content %} {%- set is_advanced_filter = request.args.get('advanced_filter') if filter_enabled else none -%} {%- set tab_list_url = url_for(view.endpoint + '.' + list_ep, id=parent_id) -%} {# Only the tab's own pane is re-rendered, from this list's URL. The marker sits inside it, so opening the tab's form swaps the marker away and the form is never refreshed under its reader. #} {% if rct.refreshes(view) %}{{ live_refresh(target=content_target, topics=rct.get_refresh_topics(view)) }}{% endif %}
{% if rct.permits('add', construct) %} {{ icon("add", size="sm") }} {{ add_label(construct, rct.record_name) }} {% else %}{% endif %} {%- if search_enabled %}
{{ keep_sort() }}
{%- if filter_enabled %} {{ icon("filter", size="md", label=construct.t("crud-advanced-filter")) }} {%- endif %}
{%- elif filter_enabled and not is_advanced_filter %} {{ icon("filter", size="md", label=construct.t("crud-advanced-filter")) }} {%- endif %}
{# The filter form sits outside the table (a
child of is invalid and gets hoisted out by the parser, orphaning these inputs). The controls stay in their cells and join it via `form=`. #} {%- if filter_enabled %} {{ keep_sort() }}
{%- endif %}
{% for fld, type in fields %} {{ sort_header(construct, fld, type, sort.link(fld) if sort else none, content_target) }} {% endfor %} {%- if filter_enabled %} {% for fld, type in fields %} {% endfor %} {%- endif %} {% for row in data %} {% for field, type in fields %} {% endfor %} {% endfor %} {% if not data %} {% endif %}
{{ construct.t(rct.name, {'count': 2}) }}
{{ construct.t("crud-action-title") }}
{% if not type.skipfilter %} {% if type.field_type == 'enum' %} {% else %} {% endif %} {% endif %}
{{ icon("search", size="md", label=construct.t("crud-simple-search")) }}
{% if type.has_display_filter() %} {# An app display filter replaces the built-in rendering. #} {{ shown(type.display_value(field, row, "related")) }} {% elif type.field_type == 'bool' %} {% if type.format_value(field, row) %} {{ icon("check", style="color: var(--fcu-success-fg); font-size: 20px; font-variation-settings: 'FILL' 1", label=construct.t("crud-bool-true")) }} {% else %} {{ icon("cancel", style="color: var(--fcu-danger-fg); font-size: 20px; font-variation-settings: 'FILL' 1", label=construct.t("crud-bool-false")) }} {% endif %} {% elif type.field_type == 'set' %} {% set val = type.format_value(field, row) %} {% if val %}
{% for item in val %} {% if item in type.sets %} {{ construct.t(type.sets[item]) }} {% endif %} {% endfor %}
{% endif %} {% elif type.field_type in ('file', 'image') %} {{ file_display(construct, type.format_value(field, row), "related") }} {% elif type.field_type == 'manyrelated' %}
{% for item in type.format_value(field, row) %} {{ item }} {% endfor %}
{% else %} {# Blank, not the word "None" — see `shown`. #} {{ shown(type.format_value(field, row)) }} {% endif %}
{% if rct.permits('edit', construct, row) %} {{ icon("edit", label=construct.t("crud-edit-button")) }} {% endif %} {% if rct.permits('view', construct, row) %} {{ icon("view", label=construct.t("crud-view-button")) }} {% endif %} {% for action in list_actions %} {{ action_control(construct, action, url_for(view.endpoint + '.' + action.endpoint, id=parent_id, child_id=row[primary_key]), "row", target=content_target, history=true) }} {% endfor %} {% if rct.permits('delete', construct, row) %} {# nosemgrep: django-no-csrf-token — Flask app; CSRF is handled by {{ csrf_field() }} below, not Django's {% csrf_token %}. #}
{{ csrf_field() }}
{% endif %}
{{ construct.t("crud-no-items-found") }}
{% if pagination and pagination.pages > 1 %}
{% endif %} {% endblock %}