host: read the type definition on a type's PUBLIC page
A type post's public page (/article/) now shows a read-only Type-definition panel: its fields,
each Composition field's block grammar ("may contain: heading, text, image, …; control blocks:
cond, each"), and the relations its instances may use — so anyone can read what a type IS, not
just admins on the edit page. host/blog--type-def-view (the read form of host/blog--type-def-
editor's data); injected in host/blog-post after the body when host/blog--is-type?.
blog 191/191, full conformance 420/420 (+ tests: the view renders fields/grammar/relations;
GET /article/ shows it, an instance's page doesn't).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1040,6 +1040,16 @@
|
||||
(let ((r (host/blog--type-relations "rtype")))
|
||||
(list (contains? r "related") (contains? r "tagged") (contains? r "is-a"))))
|
||||
(list true true false))
|
||||
;; the type definition is READABLE on a type's PUBLIC page (read-only view of the same data).
|
||||
(host-bl-test "the public type-def view shows fields, block grammar, and allowed relations"
|
||||
(let ((html (render-page (host/blog--type-def-view "article"))))
|
||||
(list (contains? html "Type definition") (contains? html "subtitle")
|
||||
(contains? html "may contain") (contains? html "Instances may be linked by")))
|
||||
(list true true true true))
|
||||
(host-bl-test "GET /article/ (public) shows the type definition; an instance's page does not"
|
||||
(list (contains? (dream-resp-body (host-bl-app (host-bl-req "/article/"))) "Type definition")
|
||||
(contains? (dream-resp-body (host-bl-app (host-bl-req "/my-first-post/"))) "Type definition"))
|
||||
(list true false))
|
||||
;; the editor renders a HAND-AUTHORED composition (text/row/alt-with-text) WITHOUT falling
|
||||
;; through to "(unknown block)" — every node kind gets a labelled row (the compose-demo case).
|
||||
(host-bl-test "the block editor renders text/layout/inline-alt nodes (no unknown block)"
|
||||
|
||||
Reference in New Issue
Block a user