Editor: one enabled field for pages and elements, shown under Access #170
Labels
No labels
bug
enhancement
needs-triage
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle#170
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#168 — the editing screens overhaul, Direction A (page module). Mockup and decision log:
docs/mockups/editing-screens/(README items 3 and 9), merged in #169.Summary
Pages and elements get one editor-facing field,
enabled, shown as a switch in an Access group of the page properties form and of every element form (and on item rows). Every place the editor shows or toggles the state (badges, tree, Enable/Disable actions, the disabled-page banner) reads that one field. This is the only part of the overhaul that touches the engine and the scaffold contract, so it lands alone and first.Current behavior
disabled(internal/element,ReservedParamDisabled) marks a disabled element; the forms API (web/src/api/forms.ts,ItemsRow.disabled) and the page-elements payload (web/src/api/pageedit.ts) expose it asdisabled: boolean. The UI offers Enable/Disable in the row menu and on the edit page; the form itself has no field for it.draftflag is the disabled marker (internal/pageops/draft.go,SetDraft;POST /api/page/draftinweb/src/api/pagemanage.ts). Every new page is born a draft; the content root cannot be drafted; a category has no Enable/Disable. The tree marks drafted pages, the page docheader has Enable/Disable in its ⋯ menu, and the page settings form has no field for it. Modules filterstatusas enabled/disabled.scaffold/site/AGENTS.mdreservesuidanddisabledas param names and documentsstatusas "the disabled marker, front-matterdraft".Desired behavior
POST /api/form,FormDescription) forkind: "properties"andkind: "element"include a boolean field namedenabled, grouped under Access, after the sidecar's own fields. Item rows exposeenabledinstead ofdisabled.hiddenfield stays a page-type field and is unchanged). On the content root the switch is shown but not operable, with the existing reason; a category's form has no Enabled field.#<uid>).enabledchanged has the same effect as today's Enable/Disable actions. Those actions stay (row menu, docheader) and the disabled-page banner's Enable page button (built in the page-module issue) uses the same operation.enabled: falseshows a Disabled badge next to the publish badge; the tree shows the page with an eye-off icon and struck-through title; an element card shows the Disabled badge and an eye-off icon. All derive from the one field.enabledin an element sidecar is a load error, exactly likeuidanddisabledtoday.enabled;disabledno longer appears in the frontend types. Route names are the implementer's call.Decisions
enabled, a switch, under Access, on both pages and elements — the maintainer's call (mockup README item 3): one positive word, one place, same on both record kinds, as TYPO3 does with "Enabled" under Access.draft; elements keep the harness-manageddisabledshortcode param, written only when the element is disabled. Reason: the content must stay vanilla Hugo (draftis how stockhugoexcludes a page) and enabled entries must stay byte-identical so saves produce quiet diffs (web/src/api/pageedit.tsdocuments that contract).enabledis the editor's name for the state;draft/disabledare its on-disk encodings.enabledjoins the reserved param names so a sidecar cannot declare a param that collides with the form's own field.draft: true) so an unfinished page never ships by accident.Key interfaces
FormDescription/FormField(web/src/api/forms.ts,web/src/widgets/types) and their server side (internal/element/form.go, the properties/create form description) — grow theenabledfield and whatever grouping the description carries;ItemsRow.disabled→enabled.internal/elementReservedParamDisabled,values.go(managed keys ignored on write),schema.go(load error for reserved names) — addenabledto the reserved set; keepdisabledas the written key.internal/pageops/draft.goSetDraftand the handler behindPOST /api/page/draft; the page settings save path (web/src/api/pagesettings.ts, its server handler) must acceptenabledas part of the properties form.DocumentNode/ page-elements payload (web/src/api/pageedit.ts): the per-element flag the tree and cards read.web/src/api/tree.ts,internal/pagetree): the per-page flag.scaffold/site/AGENTS.md: reserved param names; the Access group on forms; thestatusbuilt-in wording.internal/element/agentsdoc_test.gois the drift test.Acceptance criteria
POST /api/formfor a page's properties returns anenabledboolean field grouped under Access; for the content root it is marked not operable; for a category it is absent.POST /api/formfor a block element and each of its item rows returnsenabled; no payload or frontend type the browser uses carriesdisabledany more.enabled: falsewritesdraft: trueto the page's front matter; saving withenabled: trueremoves/clears it; the file is otherwise unchanged.enabled: falsewrites thedisabledshortcode param; saving withenabled: trueleaves nodisabledkey, and the content file is byte-identical to one saved by today's editor for an enabled element.enabledfails to load with an error naming the reserved param, likeuidanddisabled.scaffold/site/AGENTS.mddocuments theenabledfield, the Access group, and the reserved name; the drift test passes.How to verify
make test(web vitest +go test ./...), includinginternal/element/agentsdoc_test.go.make runontestdata/site: open a page's Properties, flip Enabled, save, inspect the markdown front matter; open an element, flip Enabled on the Access tab, save,git diffshows only thedisabledparam appearing/disappearing.enabledto a testdata element:harness servereports the load error.Assumptions to check
FormDescriptionalready has a notion of field groups/tabs; if not, the field needs a place in the description that the form screen issue can later map to tabs (agrouportabmarker onFormFieldis enough).disabledparam directly (scaffold/site/...,testdata/): storage is unchanged, so they keep working, but confirm nothing readsenabled.POST /api/page/draftis used by the hosted header or another client (deckle-hostedimport) before renaming or replacing it.Out of scope
draft,disabled).hidden/footernavigation flags.Blocked by
None - can start immediately
enabledfield for pages and elements, under Access #173enabledfield for pages and elements, under Access #173