feat(editor): one enabled field for pages and elements, under Access #173
No reviewers
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!173
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/170"
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?
Closes #170
What
Pages and elements get one editor-facing boolean,
enabled, shown as an Enabled switch in an Access group of the server-described forms. Badges, tree, Enable/Disable actions all read that one field. On-disk storage is unchanged: pages keep front-matterdraft, elements keep the harness-manageddisabledshortcode param, written only while disabled.Engine / server
FormFieldgainsgroup("access"),readOnly,note; newswitchwidget (settings{on, off}hints).POST /api/form: properties forms end with the Enabled field (read-only with a note on the content root, absent on categories); element forms end with it too; item rows are{uid, enabled, fields}./api/form/checkvalidatesenabledthrough the same code path as the saves.POST /api/page/save(values.enabled, items rows'enabled) andPOST /api/page/settings/save(values.enabled→draft, in the same single write; no change when the state is unchanged). An enabled element saves byte-identical.POST /api/page/draft {draft}→POST /api/page/enabled {enabled}(the hosted product does not call it).GET /api/treenodes and module entries carryenabledinstead ofdraft.enabledis a reserved element param name and a reserved page-type field name (load error naming it).Theme
Previously only item templates (
card,img) honoreddisabled. Now that any block element can be switched off, every element shortcode renders nothing whendisabledistrue/"true", through one sharedpartials/ce/disabled.htmlcheck (testdata/site templates inline it). Covered by a real-Hugo test (internal/theme/disabled_test.go).Frontend
Switch widget; Access group (element forms also show the read-only
#<uid>anchor);enabledthroughout the API types (the page tree is normalized once at the API boundary); Disabled badge on the page docheader, element card (with eye-off icon) and element docheader; tree shows eye-off + struck-through title. Enable/Disable actions and the switch stay in agreement (an open, clean properties form follows the tree's state).Docs
scaffold/site/AGENTS.mddocuments the Enabled field, the Access group, the reservedenabledname and the template contract fordisabled; the drift test now checksenabled. README wire docs updated.Verification
npm test(2056 passing),tsc --noEmit,npm run build,go vet ./...,go test ./...(with Hugo on PATH) are all green.harness serveon a copy oftestdata/site:_index.md.enabled:falsewritesdraft = true; saving withtruewritesdraft = false.disabled=true, leaving the file byte-identical to the original.enabledis reported as a load error.Notes
'…'→"…"). Main does the same, so this PR did not introduce it.togglePageEnabled/setPageEnabledare plain operations the banner can reuse.🤖 Generated with Claude Code
enabledfield for pages and elements, under Access[autoland] verdict: pass
Validated — CONCERNS (non-blocking).
Signal relied on: Forgejo Actions
ci / build-and-testgreen on the head (npm build + test, go vet, go test with Hugo 0.163.3 on PATH, go build). It covers both the frontend and the Go/Hugo paths this diff touches, so nothing was re-run. The head merges cleanly into main.Conventions: Conventional Commits title;
Closes #170present;scaffold/site/AGENTS.mdupdated in the same change (Enabled field, Access group, reservedenabled, template contract fordisabled); the drift test coversenabled.Diff vs #170: every acceptance criterion is met.
enabled;disabledis gone from the frontend types.draftand thedisabledparam are written only on change, and an enabled element saves byte-identical.enabledis a reserved param and page-type field name./api/page/draftwas renamed to/api/page/enabled. Checked: the hosted product does not call it and does not read the tree/modulesdraftfield.The theme change (every shortcode honors
disabledthroughpartials/ce/disabled.html) is required for scope: before this, only item rows could be disabled and onlycard/imghonored it. Without it the new "Kept in the file, not shown on the site" hint would be false. A real-Hugo test covers it.CONCERN (non-blocking):
scaffold/themes/deckle/README.md:126-135("The reserveddisabledparam") is now stale. It still says only a collection row's eye toggle stampsdisabled, that only item-element templates must honor it, and it shows the old inline check. Every element template must now honor it, throughce/disabled.html. A theme author who follows the README would ship block templates that ignore the Enabled switch. Suggested follow-up: a small docs fix.The lander pushed
6d7b702to the head, a docs-only fix for the non-blocking CONCERN in the approval.scaffold/themes/deckle/README.mdnow documents the reserveddisabledcontract as it stands after this PR: the Enabled switch can turn off any element, so block, inline and item templates all wrap their output in the sharedpartials/ce/disabled.htmlcheck, and the partials list namesce/disabled. No code changed.go test ./internal/initcmd/ ./internal/element/passes locally, and CI re-runs on the new head before the merge.