Files
member-console/internal/server/shell_forms.go
T
cgalo5758 88db730fcc Add dual licensing and SPDX headers
Introduce a commercial license option alongside AGPL-3.0-only, require a
CLA for contributors, and document the terms in COMMERCIAL.md and
NOTICE. Add a script to stamp SPDX headers on Go files and apply it
across the tree.
2026-09-06 02:29:42 -05:00

44 lines
2.0 KiB
Go

// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
package server
import (
"git.coopcloud.tech/wiki-cafe/member-console/internal/forms"
)
// shell.confirm (design D4, D12; docs/design-system.md "Confirm modal";
// task 5.6). The one shared confirmation dialog every destructive action on
// both surfaces opens through (shell_confirm_modal.html, driven by
// static/confirm-action-modal.js): one dialog, reused by every trigger, its
// title, body text, hidden fields, endpoint and commit class all
// reassigned by the script from the trigger's own data-action-*
// attributes at the moment it opens (design-system.md's trigger-contract
// table).
//
// Because one dialog serves many different mutations, this declaration
// carries no Fields of its own; CheckInvariants exempts the Confirm kind
// from the "declares no fields" rule for exactly this reason (a Field
// would have to belong to one trigger's shape, and every trigger's shape
// differs). The hidden fields a trigger needs are appended straight into
// the rendered <form> by the script itself, from data-action-fields; the
// body text is written into the form's Message region, which the Confirm
// kind renders unconditionally, empty at rest, so the script always has
// somewhere to write it (forms.FormView.MessageID's doc; app.css collapses
// it while empty).
//
// Method and Path below are never dispatched: the script rewrites
// hx-post/hx-delete, hx-target and hx-swap on every open, from the
// trigger's own attributes, before any submission can reach the network.
// They exist only because the invariants require a route-shaped value;
// "/partials/confirm" names no real handler and no route registers it.
var shellConfirmForm = forms.Register(forms.FormSpec{
Name: "shell.confirm",
Kind: forms.KindConfirm,
Family: forms.Stacked,
Method: "POST",
Path: "/partials/confirm",
Commit: "Confirm",
WayOut: forms.DismissModal("Cancel"),
})