{{- /* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial */ -}} {{- /* SPDX-FileCopyrightText: 2025-2026 Christian Galo */ -}} {{/* Page anatomy: the form container (spec form-library "The form part owns the container"; spec form-conventions; docs/design-system.md §8 "Forms"; design D4, D9, D10, D12, D20 to D23). Pipeline: forms.Render(spec, binding) in internal/forms, built by the handler from the form's declaration; templates write {{ template "form" .Form }} and nothing else. This part and ui_form_field.html are the only templates in the console that may render a
{{ end }} {{/* formMessage is the form's own prose region: a preview's explanation of what it is about to do, which belongs to the whole form rather than to one field. A Confirm form renders the region always, empty at rest (app.css collapses an empty one), because confirm-action-modal.js writes each trigger's body text into it after the page has loaded. FormSpec.MessageAfter moves the region below the field it names, for a message that is the consequence of one control (design D23). */}} {{ define "formMessage" }} {{ if .MessageID }}{{ else if .Message }}{{ end }} {{ end }} {{/* formRowAction is one posting control of a batch form (design D2 of staged-rule-changes; spec form-library "A batch form renders the caller's rows and one tray"): a row's Edit or Remove, a staged delta's Undo, the tray's commit, the tray's way out. Pipeline: forms.RowActionView, from FormView.RowAction in the caller's body or from the view's own Apply, Discard and each delta's Undo. It is a type="button" rather than a submit, because one form carries several acts: the act and the row's key ride in hx-vals, the whole form rides in hx-include, and the response swaps the form's own region back, so every open editor's typed values and the whole staged batch survive every press. The classes and the htmx attributes are the view's, built in Go, so no template composes a posting control by hand. */}} {{ define "formRowAction" }} {{ end }} {{/* formCommit is the commit row (design D12, D20, D23; spec form-conventions "The commit's size, width, order and in-flight state are fixed"): the commit first, at its natural width, never stretched, with its in-flight indicator inside it, then the way out as btn-outline-secondary. Solid btn-secondary is not in the palette. An always-open edit form declares no way out, because nothing is left by cancelling (finding FA-19). The commit's classes come from the view (FormView.CommitClasses), so a disabled commit is the same weight and the same height as the enabled one it stands in for. */}} {{ define "formCommit" }} {{ if .CommitState }}{{ template "disabledControl" .CommitControl }} {{ else }} {{ end }} {{ with .WayOut }}{{ if .Shown }} {{ if eq .Kind "link" }}{{ if .HXTarget }}{{ else }}{{ .Label }}{{ end }} {{ else if eq .Kind "close-panel" }} {{ else if eq .Kind "dismiss-modal" }} {{ else if eq .Kind "discard" }} {{ end }} {{ end }}{{ end }} {{ end }}