Add ext/web forms (design §5.5): fields, validate, submit, GET|POST /_form.
Also fix static links (URLs with dots) being misread as db fields. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
9599303c4c
commit
ee019fb1c2
13 files changed
+890
-46
No files matched your search
@@ -7,7 +7,7 @@ Static top links for the shell.
|
||||
| 属性 | 值 | 样式 |
|
||||
|------|-----|------|
|
||||
| Home | / | |
|
||||
| About | /about | |
|
||||
| New | /_form/article | |
|
||||
| Admin | /admin | |
|
||||
|
||||
**`nav`**
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: web-site
|
||||
description: Home = page table; main inline; class methods assemble.
|
||||
description: Home = page table; main inline; class methods assemble; form §5.5.
|
||||
> ext/web/web.mq.md
|
||||
> styles/shell.mq.md
|
||||
> components/nav.mq.md
|
||||
@@ -29,9 +29,32 @@ Main content is not a reusable component, so it is authored here.
|
||||
| `title` | articles.`articles`.title | shell.`card_title` |
|
||||
| `body` | articles.`articles`.body | shell.`card_body` |
|
||||
|
||||
Article create form (design §5.5): field table + rules table.
|
||||
|
||||
`article_fields` =
|
||||
|
||||
| 字段 | 标签 | 类型 | 必填 | 默认 |
|
||||
|------|------|------|------|------|
|
||||
| title | Title | text | true | |
|
||||
| body | Body | textarea | false | |
|
||||
|
||||
`article_rules` =
|
||||
|
||||
| 字段 | 规则 | 消息 |
|
||||
|------|------|------|
|
||||
| title | required | Title is required |
|
||||
| title | max:120 | Title is too long |
|
||||
| body | max:8000 | Body is too long |
|
||||
|
||||
*`store` = > db.open *
|
||||
*`page` = > web.page title="Marqdo Web Site" intro="<h1>Web Site</h1><p>Tables + class methods.</p>" *
|
||||
*`page` = > `page`.compose_components components=`home` *
|
||||
*`page` = > `page`.compose_main main=`index` *
|
||||
|
||||
*`article_form` = > web.form table=articles action=insert *
|
||||
*`article_form` = > `article_form`.fields fields=`article_fields` *
|
||||
*`article_form` = > `article_form`.rules rules=`article_rules` *
|
||||
|
||||
*`app` = > web.app page=`page` db=`store` admin=True host=127.0.0.1 port=18081 *
|
||||
*`app` = > `app`.mount_form id=article form=`article_form` *
|
||||
> `app`.listen
|
||||
Reference in new issue
Block a user