Files
marqdo/examples/web-site/forms.mq.md
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

2.0 KiB
Executable File

markup, title, import
markup title import
occlusion Shared article form and server validation
form document
ext/data/form.mq.md lib/document.mq.md

New and Admin place the same article form reference. The serving entry mounts this resource once at article; rendering, validation and actual database submission therefore share field definitions and rules. The public creation path remains public as in the original demonstration, while direct access to the custom desk is role-gated.

article

返回 类型 说明
result any Insert form with title, slug, summary, Markdown body and original validation limits

Grant plugin and fs.read on the site root before mounting. The adjacent literal leaf keeps field/rule data readable without turning the workflow into a data dump. Title and slug are required, with original maxima of 120 and 80 characters. Summary and body remain optional, limited to 500 and 8000 characters. These are server rules even if a caller bypasses browser constraints. Constructing the resource writes no rows and grants no authentication.

The field types remain text and textarea, retaining the original schema behavior. A rejected submission returns field messages and current CSRF for retry; success returns to the home list, where the current-query resource observes the new row. Keep every updated resource value before mounting; using an older value would lose attached fields or rules.

We fields = [Read the actual literal field contract](document.read_table(path="forms.tables.md", title="fields")) and rules = [Read the actual literal validation rules](document.read_table(path="forms.tables.md", title="rules")).

We selected = Create the actual article insertion resource and selected = [Attach the readable field records](> selected.fields fields=fields) and selected = [Attach the actual server rules](> selected.rules rules=rules). Return [Keep submission copy and its successful return target](> selected.labels submit="Publish" cancel="Cancel" cancel_href="/").