{% extends "base.html" %} {% from "model/_widgets.html" import checkbox_control, color_control, file_control, generic_control, geometry_control, keyvalue_control, nullboolean_control, password_control, range_control, readonly_control, relations_control, richtext_control, select_control, tags_control, textarea_control %} {#- One control, with its label, help and errors. A macro because the form now renders sections rather than one flat list, and the alternative -- the same sixty lines under an `{% if %}` for the titled case and again for the untitled one -- is two copies that drift. Context is passed rather than closed over, the way every macro in `_widgets.html` already takes `_` and its settings explicitly. -#} {% macro form_field(field, settings, media_url, autocomplete_url, relation_links, input_types, _) %} {# The geometry kind decides width too -- a POLYGON's textarea earns the full row the way any other textarea does, but a POINT with no map configured is still a short text box next to nothing. Mirrors `geometry_control`'s own default: a missing `GeometrySpec` reads as POINT, which is what a `formfield_overrides = {"col": "point"}` on a plain column looks like once its name resolves to "geometry". #} {% set geometry_kind = (field.spec.geometry.kind if field.spec.geometry else "POINT") if field.widget == "geometry" else "" %} {# Long controls span both columns: a textarea squeezed into half a page is worse than a taller form. #} {% set wide = field.widget in ("textarea", "json", "relations", "keyvalue", "range") or (field.widget == "geometry" and (settings.ui.map_tile_url or geometry_kind != "POINT")) %}
{{ subheading }}
{% endif %}