Add SX editor to post edit page, prevent sx_content clearing on save
- Add sx_content to _post_to_edit_dict so edit page receives existing content - Add SX/Koenig editor tabs, sx-editor mount point, and SxEditor.mount init - Only pass sx_content to writer_update when form field is present (prevents accidental clearing when editing via Koenig-only path) - Add csrf_exempt to example API POST/DELETE/PUT demo endpoints - Add defpage infrastructure (pages.py, layouts.py) and sx docs page definitions - Add defhandler definitions for example API handlers (examples.sx) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
98
sx/sxc/pages/docs.sx
Normal file
98
sx/sxc/pages/docs.sx
Normal file
@@ -0,0 +1,98 @@
|
||||
;; SX docs app — declarative page definitions
|
||||
;; These replace the GET route handlers in routes.py
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; Home page
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(defpage home
|
||||
:path "/"
|
||||
:auth :public
|
||||
:layout :sx
|
||||
:content (home-content))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; Docs section
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(defpage docs-page
|
||||
:path "/docs/<slug>"
|
||||
:auth :public
|
||||
:layout (:sx-section
|
||||
:section "Docs"
|
||||
:sub-label "Docs"
|
||||
:sub-href "/docs/introduction"
|
||||
:sub-nav (docs-nav (find-current DOCS_NAV slug))
|
||||
:selected (or (find-current DOCS_NAV slug) ""))
|
||||
:content (docs-content slug))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; Reference section
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(defpage reference-index
|
||||
:path "/reference/"
|
||||
:auth :public
|
||||
:layout (:sx-section
|
||||
:section "Reference"
|
||||
:sub-label "Reference"
|
||||
:sub-href "/reference/"
|
||||
:sub-nav (reference-nav "Attributes")
|
||||
:selected "Attributes")
|
||||
:content (reference-content ""))
|
||||
|
||||
(defpage reference-page
|
||||
:path "/reference/<slug>"
|
||||
:auth :public
|
||||
:layout (:sx-section
|
||||
:section "Reference"
|
||||
:sub-label "Reference"
|
||||
:sub-href "/reference/"
|
||||
:sub-nav (reference-nav (find-current REFERENCE_NAV slug))
|
||||
:selected (or (find-current REFERENCE_NAV slug) ""))
|
||||
:content (reference-content slug))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; Protocols section
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(defpage protocol-page
|
||||
:path "/protocols/<slug>"
|
||||
:auth :public
|
||||
:layout (:sx-section
|
||||
:section "Protocols"
|
||||
:sub-label "Protocols"
|
||||
:sub-href "/protocols/wire-format"
|
||||
:sub-nav (protocols-nav (find-current PROTOCOLS_NAV slug))
|
||||
:selected (or (find-current PROTOCOLS_NAV slug) ""))
|
||||
:content (protocol-content slug))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; Examples section
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(defpage examples-page
|
||||
:path "/examples/<slug>"
|
||||
:auth :public
|
||||
:layout (:sx-section
|
||||
:section "Examples"
|
||||
:sub-label "Examples"
|
||||
:sub-href "/examples/click-to-load"
|
||||
:sub-nav (examples-nav (find-current EXAMPLES_NAV slug))
|
||||
:selected (or (find-current EXAMPLES_NAV slug) ""))
|
||||
:content (examples-content slug))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; Essays section
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(defpage essay-page
|
||||
:path "/essays/<slug>"
|
||||
:auth :public
|
||||
:layout (:sx-section
|
||||
:section "Essays"
|
||||
:sub-label "Essays"
|
||||
:sub-href "/essays/sx-sucks"
|
||||
:sub-nav (essays-nav (find-current ESSAYS_NAV slug))
|
||||
:selected (or (find-current ESSAYS_NAV slug) ""))
|
||||
:content (essay-content slug))
|
||||
Reference in New Issue
Block a user