{# The table, its pagination and its empty states. Rendered on its own when the list updates live, and included by list.html otherwise, so both paths render exactly the same markup from exactly the same context. A separate "partial" template is how the two quietly drift apart. #} {% if drilldown %} {# Above the table and inside the fragment, so a live search redraws the links with the new term in them -- a bar drawn once at page load would carry the old one and undo the search on the next click. #} {% endif %} {% if page.items %} {# Editing in place makes the whole table one form with one Save button. A control per row posting on its own would be one request per cell and nothing to submit it with when scripting is off -- Django's `list_editable` is the same shape for the same reason. Inside `#ff-results`, so a live update replaces the form along with the rows it wraps. #} {% if list_edit_url %}
{% endif %}
{# `data-ff-columns` is this list's identity for the column-visibility and row-density preferences in fastfort.js -- read fresh on every render of this partial, including the fragment a live filter or sort swaps in, so a hidden column stays hidden across a live update without the toolbar that hides it needing to do anything itself. #} {% if actions %} {% endif %} {% for column in columns %} {% endfor %} {% for row in rows %} {# The whole row opens the record, not only the pencil. Hunting for a 16px target to open a row people have already pointed at is a step with no purpose. The linked cell is still a real link, so middle click, Ctrl+click and the keyboard all still work -- this only adds a shortcut for the plain click that lands anywhere else. #} {% if actions %} {% endif %} {% for cell in row.cells %} {% endfor %} {% endfor %}
{% if column.sort_url %} {{ column.label }} {% else %} {{ column.label }} {% endif %} {{ _("Actions") }}
{# Editable first, before any type branch. A boolean cell reached `ff_bool` and returned a tick, so `is_active` rendered no control at all -- an editable cell draws its control whatever the column's type is. #} {% if cell.editable %} {% if cell.input_widget == "checkbox" %} {% elif cell.input_widget in ("select", "relation", "nullboolean") %} {% else %} {% endif %} {% elif cell.boolean %} {{ cell.value|ff_bool }} {% elif cell.image %} {# A picture answers "which of these is the right one" faster than the stored path ever could, and the path was what this cell used to print. `loading="lazy"`, because a hundred-row page would otherwise open a hundred requests before anyone scrolled to them. #} {% if cell.thumb %} {% else %} {# A placeholder rather than nothing: rows with a picture and rows without keep the same height, so the table does not comb. #} {% endif %} {% elif cell.url %} {{ cell.value|ff_display(admin.empty_value_display) }} {% else %} {{ cell.value|ff_display(admin.empty_value_display) }} {% endif %} {# Icon buttons, always drawn. Text links revealed on hover meant the actions were invisible until the mouse found them, and invisible altogether on a touch screen. #}
{% if favorite_url %} {# Owned by the single form below the table, not by one form per row: `list_editable` already wraps the table in a form and a nested one is invalid markup the browser silently drops. A submit button carries its own name/value, so one form serves every row. #} {% endif %} {{ ff_icon("edit", size=15) }} {{ _("Edit {name}", name=row.label) }} {# `data-ff-method="post"` makes the confirmed answer delete the row, rather than following the link to the confirmation page and asking a second time. Without script the link is what it has always been: a GET to that page. #} {{ ff_icon("trash", size=15) }} {{ _("Delete {name}", name=row.label) }}
{% if list_edit_url %}
{% endif %} {% if favorite_url %} {# One form for every star on the page, referenced by `form="ff-star"` from each button. Outside the `list_editable` form on purpose -- a form inside a form is markup no browser keeps. `next` returns to this list with its filters and page intact; it is validated server-side against the open-redirect it otherwise would be. #}
{% endif %} {% else %}
{% if query.search or query.filters %}
{{ _("Nothing matched") }}

{{ _("Nothing matches the current search and filters.") }}

{{ ff_icon("filter-off", size=15) }} {{ _("Clear search and filters") }} {% else %}
{{ _("Nothing here yet") }}

{{ _("Nothing has been added to {name} yet.", name=model_title|lower)|ff_sentence }}

{% if add_url %} {{ ff_icon("plus", size=15) }} {{ _("Add the first {name}", name=model_singular|lower) }} {% endif %} {% endif %}
{% endif %}