// 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" // The workspace-create form (spec workspace-management; spec form-library; // design D2, D12; finding FA-22: the form-level failure path answered 200, // the one create form on the member surface that did). One field, one // declaration: the name a workspace's uniqueness constraint refuses lands // on the field, and every other refusal (a transaction failure, an // unreadable request) lands in the form-level slot the part always // renders; both are 422, matching every other migrated create form. // // This file is the form's home; the registry is only the index (design // D1). It sits beside workspace_partials.go, which parses through the // declaration and never through r.FormValue. const workspaceCreateFormName = "member.workspace.create" var workspaceCreateForm = forms.Register(forms.FormSpec{ Name: workspaceCreateFormName, Kind: forms.KindCreate, Family: forms.Stacked, Method: "POST", Path: "/partials/workspaces", Target: "#workspaceContent", Swap: "innerHTML", Fields: []forms.Field{ { Name: "name", Label: "Workspace name", Control: forms.Text, Placeholder: "My Workspace", Autocomplete: "off", }, }, Commit: "Create workspace", // The list's own view, scoped into the same #workspaceContent target // the create form itself swapped into, matching the hand-written // Back button this replaces (hx-get, not a real navigation). WayOut: forms.ScopedLinkOut("Back", "/partials/workspaces", "#workspaceContent"), })