From 52b4bae42346a65fa07e0fa66badb13d525d559c Mon Sep 17 00:00:00 2001 From: cflmy Date: Wed, 16 Sep 2026 19:44:12 +0800 Subject: [PATCH] feat(web-site): harden sample desk, auth login, and form layout Align nav/side/foot slots and shell CSS with table-driven admin desk; add session login/logout mount and widen form fields for usable create UX. Co-authored-by: Cursor --- examples/web-site-zh/components/desk.mq.md | 29 +++++++++++++ examples/web-site-zh/components/foot.mq.md | 1 + examples/web-site-zh/components/nav.mq.md | 16 ++++--- examples/web-site-zh/components/side.mq.md | 13 +++--- examples/web-site-zh/index.mq.md | 44 ++++++++++++++----- examples/web-site-zh/styles/shell.mq.md | 50 ++++++++++++++++------ examples/web-site/DEMO.md | 2 +- examples/web-site/components/desk.mq.md | 29 +++++++++++++ examples/web-site/components/foot.mq.md | 1 + examples/web-site/components/nav.mq.md | 16 ++++--- examples/web-site/components/side.mq.md | 13 +++--- examples/web-site/index.mq.md | 34 ++++++++++++--- examples/web-site/styles/shell.mq.md | 30 +++++++++++-- plugins/web/internal/httpx/auth.go | 40 ++++++++++------- 14 files changed, 245 insertions(+), 73 deletions(-) create mode 100644 examples/web-site-zh/components/desk.mq.md create mode 100644 examples/web-site/components/desk.mq.md diff --git a/examples/web-site-zh/components/desk.mq.md b/examples/web-site-zh/components/desk.mq.md new file mode 100644 index 0000000..5413714 --- /dev/null +++ b/examples/web-site-zh/components/desk.mq.md @@ -0,0 +1,29 @@ +--- +title: components/desk +description: 管理台壳 — 顶栏品牌为「后台」,无前台侧栏。 +--- + +## nav + +`nav` = + +| 属性 | 值 | 样式 | 媒体 | 当 | +|------|-----|------|------|-----| +| 后台 | /admin | | | | +| 站点 | / | | | | +| 写文章 | /new | | | | +| 退出 | /admin/logout | | | auth | + +*`nav`* + +## foot + +`foot` = + +| 属性 | 值 | 样式 | +|------|-----|------| +| 站点 | / | | +| 后台 | /admin | | +| 退出 | /admin/logout | | + +*`foot`* diff --git a/examples/web-site-zh/components/foot.mq.md b/examples/web-site-zh/components/foot.mq.md index bdb9c79..9b8e39b 100644 --- a/examples/web-site-zh/components/foot.mq.md +++ b/examples/web-site-zh/components/foot.mq.md @@ -8,3 +8,4 @@ | Source | https://github.com/cflmy/marqdo | | *`foot`* + diff --git a/examples/web-site-zh/components/nav.mq.md b/examples/web-site-zh/components/nav.mq.md index 0556f83..46dc894 100644 --- a/examples/web-site-zh/components/nav.mq.md +++ b/examples/web-site-zh/components/nav.mq.md @@ -1,12 +1,16 @@ ## nav +顶栏:**登录**(访客)/ **后台** + **退出**(已登录)。 + `nav` = -| 属性 | 值 | 样式 | -|------|-----|------| -| Marqdo | / | | -| 关于 | /about | | -| 写文章 | /new | | -| 后台 | /admin | | +| 属性 | 值 | 样式 | 媒体 | 当 | +|------|-----|------|------|-----| +| Marqdo | / | | | | +| 关于 | /about | | | | +| 写文章 | /new | | | | +| 登录 | /login | | | guest | +| 后台 | /admin | | | auth | +| 退出 | /admin/logout | | | auth | *`nav`* diff --git a/examples/web-site-zh/components/side.mq.md b/examples/web-site-zh/components/side.mq.md index e4d94c9..29a96e6 100644 --- a/examples/web-site-zh/components/side.mq.md +++ b/examples/web-site-zh/components/side.mq.md @@ -2,11 +2,12 @@ `side` = -| 属性 | 值 | 样式 | -|------|-----|------| -| 1. 首页 | / | | -| 2. 写文章 | /new | | -| 3. 后台 | /admin | | -| 关于 | /about | | +| 属性 | 值 | 样式 | 媒体 | 当 | +|------|-----|------|------|-----| +| 1. 首页 | / | | | | +| 2. 写文章 | /new | | | | +| 3. 登录 | /login | | | guest | +| 3. 后台 | /admin | | | auth | +| 关于 | /about | | | | *`side`* diff --git a/examples/web-site-zh/index.mq.md b/examples/web-site-zh/index.mq.md index 6dfbb8f..80bd6b9 100644 --- a/examples/web-site-zh/index.mq.md +++ b/examples/web-site-zh/index.mq.md @@ -7,6 +7,7 @@ import shell:styles/shell.mq.md import nav:components/nav.mq.md import side:components/side.mq.md import foot:components/foot.mq.md +import desk:components/desk.mq.md import articles:db/articles.mq.md import db:db/index.mq.md --- @@ -23,6 +24,15 @@ import db:db/index.mq.md | side.`side` | shell.`side_panel` | | foot.`foot` | shell.`footer` | +后台壳:去掉前台侧栏,顶栏品牌改为「后台」。 + +`desk_shell` = + +| 组件 | 样式 | +|------|------| +| desk.`nav` | shell.`topnav` | +| desk.`foot` | shell.`footer` | + `index` = | 属性 | 值 | 样式 | @@ -56,7 +66,7 @@ import db:db/index.mq.md | 标签 | GFM 表 | shell.`claim` | | 步骤 | "点击任意卡片 — /post/{slug} 用同一张 articles 表打开详情。" | shell.`step` | | 步骤 | "打开 [写文章](/new),空标题提交(规则表校验)。" | shell.`step` | -| 步骤 | "填写合法标题与 slug 提交 — 首页与后台都会出现。" | shell.`step` | +| 步骤 | "点顶栏 **登录**(admin / demo),再进 **后台** — 门禁管理台:创建表单 + 列表。" | shell.`step` | `关于引言` = @@ -78,9 +88,12 @@ import db:db/index.mq.md | 属性 | 值 | 样式 | |------|-----|------| -| 眉题 | 后台 · 表声明 | shell.`kicker` | +| 眉题 | 管理台 · 已进入后台 | shell.`kicker` | | 标题 | 后台 | shell.`intro_title` | -| 导语 | "列表与创建共用 articles schema;卡片可点进详情——不是另写一套 JS 管理端。" | shell.`lede` | +| 导语 | "这就是管理台(需登录):与前台共用 articles schema,装配成列表 + 创建表单——不是另写一套 SPA。顶栏「站点」回前台,「退出」结束会话。" | shell.`lede` | +| 标签 | 登录门禁 | shell.`claim` | +| 标签 | 表声明 | shell.`claim` | +| 标签 | "创建 + 列表" | shell.`claim` | `文章引言` = @@ -131,7 +144,7 @@ import db:db/index.mq.md **page = > page.引言装配 引言=`首页引言`** **page = > page.元数据 元数据=home_meta** **page = > page.头装配 表=fonts** -**page = > page.css css=site_css** +**page = > page.样式 样式=site_css** **page = > page.组件装配 组件=home** **page = > page.主体装配 主体=index** **page = > page.链接前缀 前缀="/post/"** @@ -139,7 +152,7 @@ import db:db/index.mq.md **about = > 网页.页面 标题="关于 · Marqdo 中文站" 壳样式="off"** **about = > about.引言装配 引言=`关于引言`** **about = > about.头装配 表=fonts** -**about = > about.css css=site_css** +**about = > about.样式 样式=site_css** **about = > about.组件装配 组件=home** **article_form = > 网页.表单 表="articles" 动作="插入"** @@ -149,15 +162,16 @@ import db:db/index.mq.md **new = > 网页.页面 标题="写文章 · Marqdo 中文站" 壳样式="off"** **new = > new.引言装配 引言=`写文章引言`** **new = > new.头装配 表=fonts** -**new = > new.css css=site_css** +**new = > new.样式 样式=site_css** **new = > new.组件装配 组件=home** **new = > new.表单装配 id="article" 表单=article_form** **desk = > 网页.页面 标题="后台 · Marqdo 中文站" 壳样式="off"** +**desk = > desk.壳HTML 体类="is-desk"** **desk = > desk.引言装配 引言=`后台引言`** **desk = > desk.头装配 表=fonts** -**desk = > desk.css css=site_css** -**desk = > desk.组件装配 组件=home** +**desk = > desk.样式 样式=site_css** +**desk = > desk.组件装配 组件=desk_shell** **desk = > desk.表单装配 id="article" 表单=article_form** **desk = > desk.主体装配 主体=index** **desk = > desk.链接前缀 前缀="/post/"** @@ -165,15 +179,25 @@ import db:db/index.mq.md **post = > 网页.页面 标题="文章 · Marqdo 中文站" 壳样式="off"** **post = > post.引言装配 引言=`文章引言`** **post = > post.头装配 表=fonts** -**post = > post.css css=site_css** +**post = > post.样式 样式=site_css** **post = > post.组件装配 组件=home** **post = > post.主体装配 主体=detail** **post = > post.查询条件 条件=by_slug** **post = > post.详情 详情=True** -**app = > 网页.应用 页面=page 数据库=store 后台=False 主机="127.0.0.1" 端口=18082 壳样式="off"** +演示账号(用户表声明;宿主会话鉴权,无作者 JS)。 + +`管理员` = + +| 用户名 | 密码 | 角色 | +|--------|------|------| +| admin | demo | admin | + +**app = > 网页.应用 页面=page 数据库=store 后台=False 主机="127.0.0.1" 端口=18082 壳样式="off" 登录回跳="/admin" 登出回跳="/"** **app = > app.路由 路径="/about" 页面=about** **app = > app.路由 路径="/new" 页面=new** **app = > app.路由 路径="/admin" 页面=desk** **app = > app.路由 路径="/post/{slug}" 页面=post** +**app = > app.鉴权 用户表=`管理员` 会话时长=3600 登录路径="/login" 登录回跳="/admin" 登出回跳="/"** +**app = > app.门禁 路径="/admin" 角色="admin" 匹配="prefix" 拒绝="redirect" 排除="/login"** > `app`.监听 diff --git a/examples/web-site-zh/styles/shell.mq.md b/examples/web-site-zh/styles/shell.mq.md index cafac02..6854683 100644 --- a/examples/web-site-zh/styles/shell.mq.md +++ b/examples/web-site-zh/styles/shell.mq.md @@ -3,7 +3,7 @@ title: styles/shell description: >- Literary dark theme for examples/web-site — ink / wine / gold after the anlian.cyou Zhang Ailing topic. GFM tables only; no author .css. -导入 网页:ext/web/网页.mq.md +import web:ext/web/web.mq.md import text:lib/text.mq.md --- @@ -151,6 +151,8 @@ wine, cold gold, serif display. | body.has-sidebar | grid-template-columns | "14rem minmax(0, 1fr)" | | body.has-sidebar | grid-template-areas | '"top top" "side main" "foot foot"' | | body.no-sidebar | grid-template-areas | '"top" "main" "foot"' | +| body.layout-stacked | grid-template-areas | '"top" "main" "foot"' | +| body.is-desk | grid-template-areas | '"top" "main" "foot"' | | header.topnav | grid-area | top | | aside.side | grid-area | side | | main.main | grid-area | main | @@ -186,14 +188,17 @@ wine, cold gold, serif display. `responsive` = -| media | 选择器 | 属性 | 值 | -|-------|--------|------|-----| +| 媒体 | 选择器 | 属性 | 值 | +|------|--------|------|-----| | (max-width: 860px) | body.has-sidebar | grid-template-columns | 1fr | | (max-width: 860px) | body.has-sidebar | grid-template-areas | '"top" "main" "side" "foot"' | | (max-width: 860px) | aside.side | border-right | "0" | | (max-width: 860px) | aside.side | border-top | 1px solid var(--border-soft) | | (max-width: 860px) | main.main | padding | "var(--space-6) var(--space-4) var(--space-8)" | | (max-width: 860px) | .content.cards | grid-template-columns | 1fr | +| (max-width: 860px) | .site-form form | grid-template-columns | 1fr | +| (max-width: 860px) | .site-form label:nth-child(1) | grid-column | "1 / -1" | +| (max-width: 860px) | .site-form label:nth-child(2) | grid-column | "1 / -1" | | (max-width: 860px) | header.topnav | padding | "0.85rem var(--space-4)" | | (max-width: 860px) | .intro_title | font-size | "2.4rem" | | (prefers-reduced-motion: reduce) | main.main | animation | none | @@ -455,6 +460,16 @@ Panel + claim/steps group layout (field look comes from named bind styles). | ul.nav a:hover | background | transparent | | ul.nav a:hover | color | var(--gold) | | ul.nav a:hover | text-decoration | none | +| ul.nav a[href="/admin"] | color | var(--gold) | +| ul.nav a[href="/admin"] | letter-spacing | "0.18em" | +| ul.nav a[href="/admin"] | border-bottom | 1px solid var(--gold-dim) | +| ul.side-nav a[href="/admin"] | color | var(--gold) | +| body.is-desk header.topnav | border-bottom | 1px solid rgba(107,30,58,0.55) | +| body.is-desk header.topnav | box-shadow | "0 12px 40px rgba(107,30,58,.18)" | +| body.is-desk .main-intro | border-left | 3px solid var(--wine) | +| body.is-desk .site-form | border-color | rgba(107,30,58,0.45) | +| body.is-desk .site-form | box-shadow | "0 0 0 1px rgba(212,175,55,.12), 0 18px 48px rgba(0,0,0,.35)" | +| body.is-desk .content.cards | margin-top | var(--space-6) | | ul.nav li:first-child a | font-family | var(--display) | | ul.nav li:first-child a | font-weight | "400" | | ul.nav li:first-child a | color | var(--gold) | @@ -466,7 +481,7 @@ Panel + claim/steps group layout (field look comes from named bind styles). | .side-label | display | block | | .side-label | font-size | "0" | | .side-label | margin | "0 0 var(--space-4)" | -| .side-label::before | content | '"路径"' | +| .side-label::before | content | '"Path"' | | .side-label::before | display | block | | .side-label::before | font-size | "0.68rem" | | .side-label::before | letter-spacing | "0.28em" | @@ -522,15 +537,18 @@ Panel + claim/steps group layout (field look comes from named bind styles). | .site-form | background | var(--glass) | | .site-form | border | 1px solid var(--border) | | .site-form | border-radius | var(--radius) | -| .site-form | padding | "var(--space-6)" | +| .site-form | padding | "var(--space-6) var(--space-6) var(--space-7, 1.75rem)" | | .site-form | margin | "0 0 var(--space-6)" | -| .site-form | max-width | "28rem" | +| .site-form | max-width | "100%" | | .site-form | width | "100%" | | .site-form | box-shadow | var(--shadow) | | .site-form | backdrop-filter | blur(16px) | | .site-form | -webkit-backdrop-filter | blur(16px) | | .site-form .meta | display | none | | .site-form form | display | grid | +| .site-form form | grid-template-columns | "minmax(0, 1fr) minmax(0, 1fr)" | +| .site-form form | column-gap | var(--space-5) | +| .site-form form | row-gap | var(--space-5) | | .site-form form | gap | var(--space-5) | | .site-form form | margin | "0" | | .site-form form | width | "100%" | @@ -538,11 +556,16 @@ Panel + claim/steps group layout (field look comes from named bind styles). | .site-form label | display | grid | | .site-form label | gap | var(--space-2) | | .site-form label | margin | "0" | +| .site-form label | min-width | "0" | | .site-form label | font-weight | "400" | | .site-form label | color | var(--gold) | | .site-form label | font-size | "0.78rem" | | .site-form label | letter-spacing | "0.16em" | | .site-form label | text-transform | uppercase | +| .site-form label:nth-child(1) | grid-column | "1" | +| .site-form label:nth-child(2) | grid-column | "2" | +| .site-form label:nth-child(n+3) | grid-column | "1 / -1" | +| .site-form .actions | grid-column | "1 / -1" | | .site-form input | -webkit-appearance | none | | .site-form textarea | -webkit-appearance | none | | .site-form input | appearance | none | @@ -554,7 +577,8 @@ Panel + claim/steps group layout (field look comes from named bind styles). | .site-form input | width | "100%" | | .site-form textarea | width | "100%" | | .site-form input | height | "2.75rem" | -| .site-form textarea | min-height | "8.5rem" | +| .site-form textarea | min-height | "10rem" | +| .site-form label:nth-child(4) textarea | min-height | "14rem" | | .site-form textarea | resize | vertical | | .site-form input | padding | "0 0.9rem" | | .site-form textarea | padding | "0.75rem 0.9rem" | @@ -629,12 +653,12 @@ Panel + claim/steps group layout (field look comes from named bind styles). **r = > responsive** **c = > chrome** **w = > widgets** -**css_v = > 网页.样式装配 名="vars" 表=v** -**css_m = > 网页.样式装配 名="motion" 表=m** -**css_l = > 网页.样式装配 名="layout" 表=l** -**css_r = > 网页.样式装配 名="responsive" 表=r** -**css_c = > 网页.样式装配 名="chrome" 表=c** -**css_w = > 网页.样式装配 名="widgets" 表=w** +**css_v = > web.make_style name="vars" table=v** +**css_m = > web.make_style name="motion" table=m** +**css_l = > web.make_style name="layout" table=l** +**css_r = > web.make_style name="responsive" table=r** +**css_c = > web.make_style name="chrome" table=c** +**css_w = > web.make_style name="widgets" table=w** `parts` = diff --git a/examples/web-site/DEMO.md b/examples/web-site/DEMO.md index 3f6f6a1..fc6bbed 100644 --- a/examples/web-site/DEMO.md +++ b/examples/web-site/DEMO.md @@ -21,7 +21,7 @@ Open http://127.0.0.1:18081/ | 3 | Open `index.mq.md` beside the browser | Narrative = program; field/rule/route/intro tables | | 4 | `/new` empty title → submit | Server validation from **rule table** (no author JS) | | 5 | `/new` valid title+slug → submit | Row appears on Home and Admin | -| 6 | `/admin` | List + create form — table-declared admin, not an SPA | +| 6 | Top-nav **Login** (`admin` / `demo`) → **Admin** | Session gate; desk shell + create form | | 7 | Terminal check | `find examples/web-site \( -name '*.js' -o -name '*.css' \)` → **0** | ## Authoring contract diff --git a/examples/web-site/components/desk.mq.md b/examples/web-site/components/desk.mq.md new file mode 100644 index 0000000..e21f59c --- /dev/null +++ b/examples/web-site/components/desk.mq.md @@ -0,0 +1,29 @@ +--- +title: components/desk +description: Admin desk chrome — brand reads Admin; no public side rail. +--- + +## nav + +`nav` = + +| front | back | style | media | when | +|-------|------|-------|-------|------| +| Admin | /admin | | | | +| Site | / | | | | +| New | /new | | | | +| Logout | /admin/logout | | | auth | + +*`nav`* + +## foot + +`foot` = + +| front | back | style | +|-------|------|-------| +| Site | / | | +| Admin | /admin | | +| Logout | /admin/logout | | + +*`foot`* diff --git a/examples/web-site/components/foot.mq.md b/examples/web-site/components/foot.mq.md index d953c05..8cb6d3a 100644 --- a/examples/web-site/components/foot.mq.md +++ b/examples/web-site/components/foot.mq.md @@ -8,3 +8,4 @@ | Source | https://github.com/cflmy/marqdo | | *`foot`* + diff --git a/examples/web-site/components/nav.mq.md b/examples/web-site/components/nav.mq.md index e132d95..92461b7 100644 --- a/examples/web-site/components/nav.mq.md +++ b/examples/web-site/components/nav.mq.md @@ -1,14 +1,16 @@ ## nav -Brand first, then demo routes. +Brand first, then demo routes. Guest sees **Login**; signed-in sees **Admin** + **Logout**. `nav` = -| front | back | style | -|-------|------|-------| -| Marqdo | / | | -| About | /about | | -| New | /new | | -| Admin | /admin | | +| front | back | style | media | when | +|-------|------|-------|-------|------| +| Marqdo | / | | | | +| About | /about | | | | +| New | /new | | | | +| Login | /login | | | guest | +| Admin | /admin | | | auth | +| Logout | /admin/logout | | | auth | *`nav`* diff --git a/examples/web-site/components/side.mq.md b/examples/web-site/components/side.mq.md index 4f96090..5321ff7 100644 --- a/examples/web-site/components/side.mq.md +++ b/examples/web-site/components/side.mq.md @@ -4,11 +4,12 @@ Hands-on demo checklist (links only — no JS). `side` = -| front | back | style | -|-------|------|-------| -| 1. Home | / | | -| 2. New form | /new | | -| 3. Admin | /admin | | -| About | /about | | +| front | back | style | media | when | +|-------|------|-------|-------|------| +| 1. Home | / | | | | +| 2. New form | /new | | | | +| 3. Login | /login | | | guest | +| 3. Admin | /admin | | | auth | +| About | /about | | | | *`side`* diff --git a/examples/web-site/index.mq.md b/examples/web-site/index.mq.md index 5df00e1..12f7525 100644 --- a/examples/web-site/index.mq.md +++ b/examples/web-site/index.mq.md @@ -8,6 +8,7 @@ import shell:styles/shell.mq.md import nav:components/nav.mq.md import side:components/side.mq.md import foot:components/foot.mq.md +import desk:components/desk.mq.md import articles:db/articles.mq.md import db:db/index.mq.md --- @@ -26,6 +27,15 @@ no hand-written business JavaScript and no author .css file. | side.`side` | shell.`side_panel` | | foot.`foot` | shell.`footer` | +Public shell (nav + side + foot). Desk shell drops the public side rail. + +`desk_shell` = + +| src | style | +|-----|-------| +| desk.`nav` | shell.`topnav` | +| desk.`foot` | shell.`footer` | + List cards: summary + slug link (click through to detail). `index` = @@ -65,7 +75,7 @@ Home intro — same bind shape as main (front / back / style). | claim | GFM tables | shell.`claim` | | step | "Click any card — /post/{slug} opens the detail page from the same articles table." | shell.`step` | | step | "Open [New](/new) and submit with an empty title (validation from a rule table)." | shell.`step` | -| step | "Submit a valid article — it appears on [Home](/) and [Admin](/admin)." | shell.`step` | +| step | "Open top-nav **Login** (admin / demo), then **Admin** — gated desk with create form + list." | shell.`step` | `about_intro` = @@ -90,9 +100,12 @@ Home intro — same bind shape as main (front / back / style). | front | back | style | |-------|------|-------| -| kicker | admin · table-declared | shell.`kicker` | +| kicker | desk · you are in admin | shell.`kicker` | | title | Admin | shell.`intro_title` | -| lede | "List and create share the articles schema. Cards link to detail pages — no separate admin SPA." | shell.`lede` | +| lede | "This is the management desk (login required): same articles schema as the public site, assembled as list + create form — not a separate SPA. Use Site in the topnav to return, or Logout to end the session." | shell.`lede` | +| claim | login-gated | shell.`claim` | +| claim | table-declared | shell.`claim` | +| claim | "create + list" | shell.`claim` | `post_intro` = @@ -172,10 +185,11 @@ Neat CJK sans for body; Great Vibes for English display. **new = > new.compose_form id="article" form=article_form** **desk = > web.page title="Admin · Marqdo Web" shell_css="off"** +**desk = > desk.chrome body_class="is-desk"** **desk = > desk.compose_intro intro=admin_intro** **desk = > desk.head table=fonts** **desk = > desk.css css=site_css** -**desk = > desk.compose_components components=home** +**desk = > desk.compose_components components=desk_shell** **desk = > desk.compose_form id="article" form=article_form** **desk = > desk.compose_main main=index** **desk = > desk.link_prefix prefix="/post/"** @@ -189,9 +203,19 @@ Neat CJK sans for body; Great Vibes for English display. **post = > post.query query=by_slug** **post = > post.detail detail=True** -**app = > web.app page=page db=store admin=False host="127.0.0.1" port=18081 shell_css="off"** +Demo credentials (table-declared users — host session auth, no author JS). + +`admins` = + +| username | password | role | +|----------|----------|------| +| admin | demo | admin | + +**app = > web.app page=page db=store admin=False host="127.0.0.1" port=18081 shell_css="off" login_redirect="/admin" logout_redirect="/"** **app = > app.route path="/about" page=about** **app = > app.route path="/new" page=new** **app = > app.route path="/admin" page=desk** **app = > app.route path="/post/{slug}" page=post** +**app = > app.auth users=admins session_ttl=3600 login_path="/login" login_redirect="/admin" logout_redirect="/"** +**app = > app.gate path="/admin" roles="admin" match="prefix" on_deny="redirect" exclude="/login"** > `app`.listen diff --git a/examples/web-site/styles/shell.mq.md b/examples/web-site/styles/shell.mq.md index 7bd5f13..780e880 100644 --- a/examples/web-site/styles/shell.mq.md +++ b/examples/web-site/styles/shell.mq.md @@ -151,6 +151,8 @@ wine, cold gold, serif display. | body.has-sidebar | grid-template-columns | "14rem minmax(0, 1fr)" | | body.has-sidebar | grid-template-areas | '"top top" "side main" "foot foot"' | | body.no-sidebar | grid-template-areas | '"top" "main" "foot"' | +| body.layout-stacked | grid-template-areas | '"top" "main" "foot"' | +| body.is-desk | grid-template-areas | '"top" "main" "foot"' | | header.topnav | grid-area | top | | aside.side | grid-area | side | | main.main | grid-area | main | @@ -194,6 +196,9 @@ wine, cold gold, serif display. | (max-width: 860px) | aside.side | border-top | 1px solid var(--border-soft) | | (max-width: 860px) | main.main | padding | "var(--space-6) var(--space-4) var(--space-8)" | | (max-width: 860px) | .content.cards | grid-template-columns | 1fr | +| (max-width: 860px) | .site-form form | grid-template-columns | 1fr | +| (max-width: 860px) | .site-form label:nth-child(1) | grid-column | "1 / -1" | +| (max-width: 860px) | .site-form label:nth-child(2) | grid-column | "1 / -1" | | (max-width: 860px) | header.topnav | padding | "0.85rem var(--space-4)" | | (max-width: 860px) | .intro_title | font-size | "2.4rem" | | (prefers-reduced-motion: reduce) | main.main | animation | none | @@ -455,6 +460,16 @@ Panel + claim/steps group layout (field look comes from named bind styles). | ul.nav a:hover | background | transparent | | ul.nav a:hover | color | var(--gold) | | ul.nav a:hover | text-decoration | none | +| ul.nav a[href="/admin"] | color | var(--gold) | +| ul.nav a[href="/admin"] | letter-spacing | "0.18em" | +| ul.nav a[href="/admin"] | border-bottom | 1px solid var(--gold-dim) | +| ul.side-nav a[href="/admin"] | color | var(--gold) | +| body.is-desk header.topnav | border-bottom | 1px solid rgba(107,30,58,0.55) | +| body.is-desk header.topnav | box-shadow | "0 12px 40px rgba(107,30,58,.18)" | +| body.is-desk .main-intro | border-left | 3px solid var(--wine) | +| body.is-desk .site-form | border-color | rgba(107,30,58,0.45) | +| body.is-desk .site-form | box-shadow | "0 0 0 1px rgba(212,175,55,.12), 0 18px 48px rgba(0,0,0,.35)" | +| body.is-desk .content.cards | margin-top | var(--space-6) | | ul.nav li:first-child a | font-family | var(--display) | | ul.nav li:first-child a | font-weight | "400" | | ul.nav li:first-child a | color | var(--gold) | @@ -522,15 +537,18 @@ Panel + claim/steps group layout (field look comes from named bind styles). | .site-form | background | var(--glass) | | .site-form | border | 1px solid var(--border) | | .site-form | border-radius | var(--radius) | -| .site-form | padding | "var(--space-6)" | +| .site-form | padding | "var(--space-6) var(--space-6) var(--space-7, 1.75rem)" | | .site-form | margin | "0 0 var(--space-6)" | -| .site-form | max-width | "28rem" | +| .site-form | max-width | "100%" | | .site-form | width | "100%" | | .site-form | box-shadow | var(--shadow) | | .site-form | backdrop-filter | blur(16px) | | .site-form | -webkit-backdrop-filter | blur(16px) | | .site-form .meta | display | none | | .site-form form | display | grid | +| .site-form form | grid-template-columns | "minmax(0, 1fr) minmax(0, 1fr)" | +| .site-form form | column-gap | var(--space-5) | +| .site-form form | row-gap | var(--space-5) | | .site-form form | gap | var(--space-5) | | .site-form form | margin | "0" | | .site-form form | width | "100%" | @@ -538,11 +556,16 @@ Panel + claim/steps group layout (field look comes from named bind styles). | .site-form label | display | grid | | .site-form label | gap | var(--space-2) | | .site-form label | margin | "0" | +| .site-form label | min-width | "0" | | .site-form label | font-weight | "400" | | .site-form label | color | var(--gold) | | .site-form label | font-size | "0.78rem" | | .site-form label | letter-spacing | "0.16em" | | .site-form label | text-transform | uppercase | +| .site-form label:nth-child(1) | grid-column | "1" | +| .site-form label:nth-child(2) | grid-column | "2" | +| .site-form label:nth-child(n+3) | grid-column | "1 / -1" | +| .site-form .actions | grid-column | "1 / -1" | | .site-form input | -webkit-appearance | none | | .site-form textarea | -webkit-appearance | none | | .site-form input | appearance | none | @@ -554,7 +577,8 @@ Panel + claim/steps group layout (field look comes from named bind styles). | .site-form input | width | "100%" | | .site-form textarea | width | "100%" | | .site-form input | height | "2.75rem" | -| .site-form textarea | min-height | "8.5rem" | +| .site-form textarea | min-height | "10rem" | +| .site-form label:nth-child(4) textarea | min-height | "14rem" | | .site-form textarea | resize | vertical | | .site-form input | padding | "0 0.9rem" | | .site-form textarea | padding | "0.75rem 0.9rem" | diff --git a/plugins/web/internal/httpx/auth.go b/plugins/web/internal/httpx/auth.go index a1c3392..ee231cc 100644 --- a/plugins/web/internal/httpx/auth.go +++ b/plugins/web/internal/httpx/auth.go @@ -314,9 +314,10 @@ func (st *state) mountAuthRoutes(mux *http.ServeMux) { mux.HandleFunc("GET "+altLogin, st.handleLoginGet) mux.HandleFunc("POST "+altLogin, st.handleLoginPost) } + // Logout is part of session auth, not only built-in admin=True chrome. + logoutPath := strings.TrimRight(st.auth.adminPrefix, "/") + "/logout" + mux.HandleFunc("GET "+logoutPath, st.handleLogout) if st.auth.admin { - logoutPath := strings.TrimRight(st.auth.adminPrefix, "/") + "/logout" - mux.HandleFunc("GET "+logoutPath, st.handleLogout) adminHome := strings.TrimRight(st.auth.adminPrefix, "/") if adminHome == "" { adminHome = "/admin" @@ -427,29 +428,34 @@ func loginPageHTML(loginAction string, errMsg *string, csrf string, next string) nextField = fmt.Sprintf("", esc(next)) } return fmt.Sprintf(` - + Admin Login - + `, errHTML, esc(loginAction), csrfField, nextField) }