{% extends "structure/base.html" %} {% from 'crud/_macros.html' import render_field, render_form_errors, render_layout, version_inputs, conflict_notice, conflict_mark, form_enctype, record_tabs %} {% from 'crud/_actions.html' import action_control %} {% from 'components/_page_header.html' import page_header %} {% from 'components/_form_actions.html' import form_actions %} {#- The record's own name heads its pages when the view gives one (record_title); else the generic "Edit ". #} {%- set record_title = view.record_title(data[primary_key]) %} {%- set heading = record_title or construct.t_rec('crud-edit-rec', view.name) %} {% block title %}{{ construct.compose_title(heading) }}{% endblock %} {#- A form without tabs is one record's fields: the narrower form width (--fcu-form-max-width). With tabs it is a record's home page. #} {% block main_class %}{% if not tab_actions %}fcu-main-content--form{% endif %}{% endblock %} {# This view renders its own visible

, so suppress the layout default. #} {% block page_heading %}{% endblock %} {% block content %} {#- One header for both layouts, above the card (the page_header macro, components/_page_header.html): title, back to the list, and the record's actions. #} {% call page_header(heading, subtitle=view.record_subtitle(data[primary_key]) if record_title else none, back_url=view.url, back_label=construct.t('crud-back-button'), back_target="#main-content", css_class="fcu-crud-header") %} {%- for action in edit_actions or [] %} {{ action_control(construct, action, url_for(view.endpoint + '.' + action.endpoint, id=data[primary_key]), action.variant or "icon", target="#main-content") }} {%- endfor %} {% endcall %}
{#- With tabs, the record's tabs head the card; the form below them is the same as without (one action bar, the same blocks). #} {% if tab_actions %}{{ record_tabs(construct, view, data[primary_key], tab_actions, 'edit') }}{% endif %}
{{ csrf_field() }} {{ version_inputs(version_state | default(none)) }} {% block form_body %} {{ render_form_errors(construct, errors) }}
{% block presence %}{% if view.presence_in("edit") %}{{ presence_notice(view.presence_key(data[primary_key]), "editing") }}{% endif %}{% endblock %} {{ conflict_notice(construct, conflict | default(none), fields, conflict_reload_url | default('')) }} {% call(field, type) render_layout(construct, form_layout | default(none), fields, errors) %} {{ conflict_mark(construct, field, type, conflict | default(none)) }} {{ render_field(construct, field, type, view, data, ds, errors=errors) }} {% endcall %}
{% endblock %} {% call form_actions() %} {% block form_actions %} {{ icon("cancel", size="sm") }} {{ construct.t("crud-cancel-button") }} {% endblock %} {% endcall %}
{% block form_scripts %}{{ form_scripts | default('') | safe }}{% endblock %} {% endblock %}