Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
5e3f723
mv Section definition
Jan 6, 2026
6f18f95
support passing no meta map to defc
Jan 6, 2026
6518629
start packing the kitchen sink
Jan 7, 2026
fed6ad4
add CRUST assets
Jan 7, 2026
78bff4c
fix page title, support options to Page
Jan 7, 2026
82c5367
fix sticky toggle button
Jan 7, 2026
449a941
fix title for realz
Jan 7, 2026
6b138bc
basic CRUST pattern lib with ComponentExample(s)
Jan 7, 2026
a0f2d68
mv PatternLibrary to its own ns, extract ToC to theme
Jan 7, 2026
6b12cce
refactor pattern sections
Jan 7, 2026
f2d9aa0
generate crust.lib/PatternLibrary from publics
Jan 7, 2026
2618bc2
refactor PatternLibrary
Jan 7, 2026
b660cbd
document document title
Jan 8, 2026
0bc97c2
mv ::hook-fn into component ns
Jan 8, 2026
fdcafa1
port hr styles
Jan 8, 2026
78bdb90
syntax TODO
Jan 8, 2026
ad84264
.success message in account
Jan 8, 2026
9bbdb0c
port LoginPage to crust
Jan 8, 2026
54f75a6
port LogoutForm
Jan 8, 2026
d35e2b7
cleanup unused theme fn
Jan 8, 2026
7c06048
port AccountPage
Jan 8, 2026
a8a6ae2
port generic Sections
Jan 8, 2026
e329ea2
fix indentation
Jan 8, 2026
6d99f58
cleanup, comments
Jan 8, 2026
18550ab
support markdown in DocSection content
Jan 8, 2026
6a75fe8
make sections into fns
Jan 8, 2026
ed79bd2
fix accept-language i18n bug
Jan 8, 2026
41db7ee
expand box-sizing rule
Jan 8, 2026
6466c84
install highlight.js w/ modified atom theme
Jan 9, 2026
96608ed
highlight clj/html syntax
Jan 9, 2026
4300fe0
specify generic <pre> styles
Jan 9, 2026
a99a614
track test images
Jan 9, 2026
d80efa7
tweak code colors
Jan 9, 2026
0108bdb
s/crust/rise
Jan 9, 2026
5552a25
parse markdown in pattern copy
Jan 9, 2026
ad6a479
section links
Jan 9, 2026
4aaf0db
s/cname/component-name
Jan 9, 2026
caec75a
section links for examples
Jan 9, 2026
434ddc2
fix ToC, sort of
Jan 9, 2026
85cdb7d
stroke-style-hover
Jan 9, 2026
3087788
s/-hover/-emphasis
Jan 9, 2026
1dace48
#seconds-ago aero reader
Jan 9, 2026
2278580
fix seeded unconfirmed email created-at
Jan 9, 2026
bcd4ca4
check email created-at if updated-at is nil
Jan 9, 2026
2db4d91
port ConfirmPage
Jan 9, 2026
8cb8ead
fix typo
Jan 9, 2026
997bf48
secure signup
Jan 9, 2026
4f4dd38
port SignupPage
Jan 9, 2026
5052641
port EmailPage
Jan 9, 2026
3e26ef0
AccountNav
Jan 9, 2026
6943b49
DRY up account pages w/ SettingsPage cpt
Jan 9, 2026
cf7ed60
tweak pre/code styles
Jan 9, 2026
4ccb894
document AccountNav
Jan 9, 2026
5dc5423
render map keys as HTML comments
Jan 10, 2026
95c67c8
document SettingsPage and its relationship with AccountNav
Jan 10, 2026
6c6293b
support :doc/post-render option in component metadata
Jan 10, 2026
38369e8
merge default-data and args one level deep
Jan 10, 2026
0f12058
eliminate list from ::account-form section
Jan 10, 2026
fc492d4
handle nil descriptions
Jan 10, 2026
4f6db1c
document AccountPage
Jan 10, 2026
01c77f5
render examples in ToC
Jan 10, 2026
7194d05
document :html.account.sections
Jan 10, 2026
0920b1c
extract component/render fn from ::render hook
Jan 10, 2026
5d8f07a
refactor
Jan 10, 2026
a963107
Field component
Jan 12, 2026
72aed18
password/confirmation Fields
Jan 12, 2026
fac9b34
i18n/t
Jan 12, 2026
f9cdec4
ErrorMessage component
Jan 12, 2026
20405c2
Submit component
Jan 12, 2026
c9fe806
use Submit from :save
Jan 12, 2026
270dd6f
replace more ErrorMessages
Jan 12, 2026
ebd3ec6
rm optional metadata map
Jan 12, 2026
f1a5dba
swap i18n/t fn arg order, rm inlined version
Jan 12, 2026
45a2622
conditionally render example heading/link
Jan 12, 2026
15ce643
implement Error/SuccessMessage components
Jan 12, 2026
86eed39
conditionally render example sections in ToC
Jan 12, 2026
54a0541
CRUST
Jan 14, 2026
49f1ea6
basic CRUST styles
Jan 14, 2026
b5c33e6
support :edn+html field format
Jan 14, 2026
c95df65
make Nav/Item into components
Jan 15, 2026
5e5a55e
navigation hack to fix stylesheets
Jan 15, 2026
a5aecfc
fix ::navigation/items bug
Jan 15, 2026
cf768b7
bring back navigation!
Jan 15, 2026
c40a660
basic CRUST layout
Jan 15, 2026
af959c6
basic formatting + color scheme for CRUST
Jan 16, 2026
e013baa
strike Courier New
Jan 16, 2026
aa06d59
quote font names
Jan 16, 2026
633dc0c
simplify home page content
Jan 16, 2026
0ed4863
convert sibling vecs to HTML before rendering HtmlStrings
Jan 16, 2026
2140f87
rename ::route/uri-fn hook
Jan 16, 2026
53990c7
style InteriorPage
Jan 16, 2026
bb0fe0e
properly format NotFoundPage
Jan 16, 2026
3110356
simplify :tag taxonomy, rename ::tag dispatcher
Jan 16, 2026
db27ea7
fix slug param in ::taxon=> dispatcher, make route param configurable
Jan 16, 2026
fb36ffe
set *print-namespace-maps* false by default
Jan 17, 2026
ab536f8
seed more tags
Jan 17, 2026
c0f3c5f
always query for requisite :thing/_taxon attrs for filtering
Jan 17, 2026
7909d9f
s~:thing/slug*~:slugs
Jan 17, 2026
7b96a3b
FIX HORRIBLE QUERY INFERENCE BUG
Jan 17, 2026
988a906
CRUSTY STYLE
Jan 17, 2026
d3ba8c0
mark bg
Jan 17, 2026
01413a6
s/sequential?/seq?
Jan 18, 2026
31aea5d
niceness
Jan 18, 2026
26d0086
:thing/authors
Jan 19, 2026
ff1a05f
more experiments w/ side indexing
Jan 19, 2026
3fe9a93
fix :thing/authors in CRUST and elsewhere
Jan 21, 2026
56c2c1e
handle CSRF protection
Jan 23, 2026
52bbc00
s/sequential?/seq in i18n
Mar 12, 2026
00d5218
tweak db/connect for readability
Mar 12, 2026
c750335
fix account, email forms
Mar 12, 2026
1a0d729
lol
Mar 12, 2026
6948006
port email components to RISE
Mar 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cms/systems/bread/alpha/cms/config/bread.cljc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(ns systems.bread.alpha.cms.config.bread
(:require
[aero.core :as aero]
[integrant.core :as ig]))
[integrant.core :as ig]
[systems.bread.alpha.internal.time :as t]))

(defmethod aero/reader 'ig/ref [_ _ value]
(ig/ref value))
Expand All @@ -11,3 +12,6 @@
(when-not (var? var*)
(throw (ex-info (str sym " does not resolve to a var") {:symbol sym})))
var*))

(defmethod aero/reader 'seconds-ago [_ _ n]
(t/seconds-ago n))
45 changes: 38 additions & 7 deletions cms/systems/bread/alpha/cms/data.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,42 @@
:field/content "Le Titre"}
{:field/key :content
:field/lang :en
:field/format :edn
:field/content (pr-str [{:a "some content" :b "more content"}])}
:field/format :html
:field/content
"<h2>Some content</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel egestas sapien, vel gravida lacus. Morbi placerat lorem justo, luctus pretium sem mattis ac. Maecenas convallis lorem a enim iaculis luctus. Pellentesque malesuada elit et sodales efficitur. Integer quis blandit felis. Aenean fringilla magna quis lacinia egestas. Praesent neque mauris, aliquam quis elementum quis, sagittis sit amet diam. Nulla eu scelerisque tortor, nec condimentum erat.</p>
<h2>More content</h2>
<p>Cras tellus purus, ultricies nec augue ut, lacinia dignissim leo. Quisque eros erat, semper ut ornare et, mattis at ipsum. Pellentesque odio dui, hendrerit sollicitudin ultricies fringilla, feugiat at turpis. Curabitur quam felis, dapibus mollis tellus a, accumsan euismod mauris. Suspendisse dictum commodo arcu, eget pharetra nibh aliquet ut. Duis accumsan nec leo a dignissim. Nam nunc massa, vulputate non neque vel, convallis congue nisi. Maecenas ut cursus orci.</p>
<p>Duis ipsum nunc, gravida ut est sit amet, facilisis luctus enim. Maecenas eget sapien aliquam odio luctus eleifend sed sit amet metus. Nulla malesuada efficitur odio. Aenean ligula ipsum, faucibus maximus consectetur eget, condimentum placerat nibh. Nunc laoreet luctus velit vel dignissim. Pellentesque hendrerit purus et leo tincidunt, egestas finibus turpis tempor. Curabitur ut ligula sit amet justo vulputate condimentum. Phasellus aliquet magna et est convallis blandit. Nullam eros magna, ornare at tempus et, pellentesque non justo.</p>
<p>Integer faucibus mauris quis lobortis consequat. Sed ac congue arcu. Nunc convallis, massa non imperdiet consequat, mi nibh iaculis elit, mollis dignissim ipsum quam vitae felis. Aliquam laoreet tellus odio, nec molestie erat pretium sed. Quisque lacus tortor, hendrerit ut nulla at, rhoncus malesuada velit. Nunc rhoncus interdum mi, nec dictum nisi ullamcorper vel. Fusce sed porta felis. Suspendisse sagittis ornare nulla. Suspendisse potenti. Sed sed ligula malesuada, pulvinar mauris sed, vehicula sapien. Vestibulum nec ipsum quis orci condimentum volutpat. Quisque sollicitudin mi in enim mollis, ac pretium enim interdum.</p>
<p>Aenean nunc nulla, finibus sed tortor eget, lobortis viverra tortor. In in orci maximus, mollis nulla finibus, blandit nunc. Nulla facilisi. Morbi quis nisi a massa consequat porta nec ut turpis. Proin varius porttitor euismod. Vivamus elit felis, suscipit vel ullamcorper luctus, eleifend vel lacus. Vivamus vestibulum elit quis volutpat commodo. Curabitur dapibus porttitor ultrices. Etiam facilisis lorem vitae diam pulvinar, at ullamcorper augue rutrum.</p>
<h2>And some more...</h2>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>"
,}
{:field/key :content
:field/lang :fr
:field/format :edn
:field/content (pr-str [{:a "le content" :b "et plus"}])}}}
:field/format :html
:field/content
"<h2>Le content</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel egestas sapien, vel gravida lacus. Morbi placerat lorem justo, luctus pretium sem mattis ac. Maecenas convallis lorem a enim iaculis luctus. Pellentesque malesuada elit et sodales efficitur. Integer quis blandit felis. Aenean fringilla magna quis lacinia egestas. Praesent neque mauris, aliquam quis elementum quis, sagittis sit amet diam. Nulla eu scelerisque tortor, nec condimentum erat.</p>
<h2>Et plus</h2>
<p>Cras tellus purus, ultricies nec augue ut, lacinia dignissim leo. Quisque eros erat, semper ut ornare et, mattis at ipsum. Pellentesque odio dui, hendrerit sollicitudin ultricies fringilla, feugiat at turpis. Curabitur quam felis, dapibus mollis tellus a, accumsan euismod mauris. Suspendisse dictum commodo arcu, eget pharetra nibh aliquet ut. Duis accumsan nec leo a dignissim. Nam nunc massa, vulputate non neque vel, convallis congue nisi. Maecenas ut cursus orci.</p>
<p>Duis ipsum nunc, gravida ut est sit amet, facilisis luctus enim. Maecenas eget sapien aliquam odio luctus eleifend sed sit amet metus. Nulla malesuada efficitur odio. Aenean ligula ipsum, faucibus maximus consectetur eget, condimentum placerat nibh. Nunc laoreet luctus velit vel dignissim. Pellentesque hendrerit purus et leo tincidunt, egestas finibus turpis tempor. Curabitur ut ligula sit amet justo vulputate condimentum. Phasellus aliquet magna et est convallis blandit. Nullam eros magna, ornare at tempus et, pellentesque non justo.</p>
<p>Integer faucibus mauris quis lobortis consequat. Sed ac congue arcu. Nunc convallis, massa non imperdiet consequat, mi nibh iaculis elit, mollis dignissim ipsum quam vitae felis. Aliquam laoreet tellus odio, nec molestie erat pretium sed. Quisque lacus tortor, hendrerit ut nulla at, rhoncus malesuada velit. Nunc rhoncus interdum mi, nec dictum nisi ullamcorper vel. Fusce sed porta felis. Suspendisse sagittis ornare nulla. Suspendisse potenti. Sed sed ligula malesuada, pulvinar mauris sed, vehicula sapien. Vestibulum nec ipsum quis orci condimentum volutpat. Quisque sollicitudin mi in enim mollis, ac pretium enim interdum.</p>
<p>Aenean nunc nulla, finibus sed tortor eget, lobortis viverra tortor. In in orci maximus, mollis nulla finibus, blandit nunc. Nulla facilisi. Morbi quis nisi a massa consequat porta nec ut turpis. Proin varius porttitor euismod. Vivamus elit felis, suscipit vel ullamcorper luctus, eleifend vel lacus. Vivamus vestibulum elit quis volutpat commodo. Curabitur dapibus porttitor ultrices. Etiam facilisis lorem vitae diam pulvinar, at ullamcorper augue rutrum.</p>
<h2>Et maintenant, plus...</h2>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>"
,}}}
{:db/id "page.child"
:post/type :page
:thing/slug "child-page"
:thing/created-at #inst "2026-01-01T04:20:00-08:00"
:post/status :post.status/published
:post/taxons ["tag.two"]
:thing/children ["page.grandchild"]
:thing/fields
#{{:field/key :title
Expand All @@ -45,7 +71,9 @@
{:db/id "page.daughter"
:post/type :page
:thing/slug "daughter-page"
:thing/created-at #inst "2025-10-10T05:53:00-08:00"
:post/status :post.status/draft
:post/taxons ["tag.one"]
:thing/fields
#{{:field/key :title
:field/lang :en
Expand All @@ -56,6 +84,7 @@
{:db/id "page.parent"
:post/type :page
:thing/slug "hello"
:thing/created-at #inst "2025-03-16T14:21:22-08:00"
:thing/children ["page.child" "page.daughter"]
:post/taxons ["tag.one" "tag.two"]
:post/status :post.status/published
Expand Down Expand Up @@ -98,7 +127,9 @@
{:db/id "page.grandchild"
:post/type :page
:thing/slug "grandchild-page"
:thing/created-at #inst "2024-01-15T13:12:42-08:00"
:post/status :post.status/published
:post/taxons ["tag.one" "tag.two"]
:thing/fields
#{{:field/key :title
:field/lang :en
Expand All @@ -108,7 +139,7 @@
:field/content "Petit Enfant Page"}}}
{:db/id "tag.one"
:thing/slug "one"
:taxon/taxonomy :taxon.taxonomy/tag
:taxon/taxonomy :tag
:thing/fields
[{:field/key :name
:field/content "One"
Expand All @@ -118,7 +149,7 @@
:field/lang :fr}]}
{:db/id "tag.two"
:thing/slug "two"
:taxon/taxonomy :taxon.taxonomy/tag
:taxon/taxonomy :tag
:thing/fields
[{:field/key :name
:field/content "Two"
Expand Down Expand Up @@ -198,7 +229,7 @@
:field/content "Doggo"}
{:field/key :alt-text
:field/lang :fr
:field/content "un chat"}}}
:field/content "un chien"}}}

;; Site-wide translations
{:field/lang :en
Expand Down
118 changes: 87 additions & 31 deletions cms/systems/bread/alpha/cms/main.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
[taoensso.timbre :as log]

[systems.bread.alpha.core :as bread]
[systems.bread.alpha.component :as component]
[systems.bread.alpha.cms.theme :as theme]
[systems.bread.alpha.cms.theme.crust :as crust]
[systems.bread.alpha.cms.theme.rise :as rise]
[systems.bread.alpha.cms.data :as data]
[systems.bread.alpha.i18n :as i18n]
[systems.bread.alpha.post :as post]
Expand All @@ -25,6 +28,7 @@
[systems.bread.alpha.defaults :as defaults]
[systems.bread.alpha.ring :as bread.ring]
[systems.bread.alpha.schema :as schema]
[systems.bread.alpha.taxon :as taxon]
[systems.bread.alpha.user :as user]
[systems.bread.alpha.util.logging :refer [log-redactor]]
[systems.bread.alpha.cms.config.bread]
Expand All @@ -33,6 +37,9 @@
[systems.bread.alpha.plugin.datahike]
[systems.bread.alpha.plugin.email :as email]
[systems.bread.alpha.plugin.marx :as marx]
[systems.bread.alpha.navigation :as navigation]
#_ ;; TODO
[systems.bread.alpha.plugin.navigation :as navigation]
[systems.bread.alpha.plugin.reitit]
[systems.bread.alpha.plugin.rum :as rum]
[systems.bread.alpha.plugin.signup :as signup]
Expand All @@ -45,6 +52,8 @@
[org.sqlite JDBC])
(:gen-class))

(set! *print-namespace-maps* false)

(defn not-found [req]
{:body "not found"
:status 404})
Expand All @@ -57,6 +66,16 @@
{:root "marx"
:path "/marx"}))

(def crust-handler
(reitit.ring/create-resource-handler
{:root "crust"
:path "/crust"}))

(def rise-handler
(reitit.ring/create-resource-handler
{:root "rise"
:path "/rise"}))

(def router
(reitit/router
["/"
Expand All @@ -65,19 +84,15 @@
["/login"
{:name :login
:dispatcher/type ::auth/login=>
:dispatcher/component #'auth/LoginPage}]
["/signup"
{:name :signup
:dispatcher/type ::signup/signup=>
:dispatcher/component #'signup/SignupPage}]
:dispatcher/component #'rise/LoginPage}]
["/account"
{:name :account
:dispatcher/type ::account/account=>
:dispatcher/component #'account/AccountPage}]
:dispatcher/component #'rise/AccountPage}]
["/email"
{:name :email
:dispatcher/type ::email/settings=>
:dispatcher/component #'email/EmailPage}]
:dispatcher/component #'rise/EmailPage}]
["/edit"
{:name :edit
:dispatcher/type ::marx/edit=>}]
Expand All @@ -89,34 +104,42 @@
["_"
["/confirm-email"
{:name :confirm-email
:dispatcher/type ::email/confirm=>
:dispatcher/component #'email/ConfirmPage}]]
:dispatcher/type ::email/confirm=>
:dispatcher/component #'rise/ConfirmPage}]
["/patterns"
["/rise"
{:name :patterns.rise
:dispatcher/type ::component/standalone=>
:dispatcher/component #'rise/PatternLibrary}]]
["/signup"
{:name :signup
:dispatcher/type ::signup/signup=>
:dispatcher/component #'rise/SignupPage}]]
["assets/*"
(reitit.ring/create-resource-handler
{})]
;; TODO publish to assets?
["marx/*" marx-handler]
["crust/*" crust-handler]
["rise/*" rise-handler]
["{field/lang}"
[""
{:name :home
:dispatcher/type ::post/page=>
:dispatcher/component #'theme/HomePage}]
:dispatcher/component #'crust/HomePage}]
["/i/{db/id}"
{:name :id
:dispatcher/type ::thing/by-id=>
:dispatcher/component #'theme/InteriorPage}]
:dispatcher/component #'crust/InteriorPage}]
["/tag/{thing/slug}"
{:name :tag
:dispatcher/type ::post/tag ;; TODO
:dispatcher/component #'theme/Tag}]
["/{thing/slug*}"
:dispatcher/type ::taxon/tag=>
:dispatcher/component #'crust/Tag
:post/type :page}]
["/*slugs"
{:name :page
:dispatcher/type ::post/page=>
:dispatcher/component #'theme/InteriorPage}]
["/page/{thing/slug*}" ;; TODO
{:name :page!
:dispatcher/type ::post/page=>
:dispatcher/component #'theme/InteriorPage}]]]
:dispatcher/component #'crust/InteriorPage}]]]
{:conflicts nil}))

(def cli-options
Expand Down Expand Up @@ -348,8 +371,10 @@
(signup/plugin (:signup app-config))
(account/plugin (:account app-config))
(marx/plugin (:marx app-config))
(navigation/plugin (:navigation app-config))
(rum/plugin (:renderer app-config))
(email/plugin (:email app-config))])]
(email/plugin (:email app-config))
(theme/plugin (:theme app-config))])]
(bread/load-app (bread/app {:plugins plugins}))))

(defmethod ig/halt-key! :bread/app [_ app]
Expand All @@ -364,8 +389,6 @@
true)

(comment
(set! *print-namespace-maps* false)

(require '[flow-storm.api :as flow])
(flow/local-connect)

Expand Down Expand Up @@ -613,24 +636,27 @@
:thing/_children [{:thing/slug "b"
:thing/_children [{:thing/slug "a"}]}]})

(def $router (route/router (->app $req)))

(reitit/match-by-path router "/en/a")
(reitit/match-by-path router "/en/a/b/c")
(-> router
(reitit/match-by-path "/en/tag/two")
:data :name)
(reitit/match->path
(reitit/match-by-path $router "/en/a/b/c")
{:field/lang :en :thing/slug* "a/b/c"})
(reitit/match-by-path router "/en/a/b/c")
{:field/lang :en :slugs "a/b/c"})
(reitit/match->path
(reitit/match-by-name $router :page {:field/lang :en :thing/slug* "x"}))
(reitit/match-by-name router :page {:field/lang :en :slugs "x"}))

(bread/routes $router)
(bread/route-params $router $req)
(bread/routes router)
(bread/route-params router $req)

;; route/uri infers params and then just calls bread/path under the hood...
(bread/path $router :page {:field/lang :en :thing/slug* "a/b/c"})
(bread/path router :page {:field/lang :en :slugs "a/b/c"})
(route/uri (->app $req) :page (merge {:field/lang :en} grandchild))
(route/uri (->app $req) :page! (merge {:field/lang :en} grandchild))

(route/ancestry grandchild)
(bread/infer-param :thing/slug* grandchild)
(bread/infer-param :slugs grandchild)
(bread/routes (route/router (->app $req)))

(route/uri (->app $req) :page (merge {:field/lang :en} grandchild))
Expand Down Expand Up @@ -693,13 +719,43 @@
(find-path adjacents seen :thing/slug))
(def full-path
(vec (concat [:field/lang] path)))
;; -> [:field/lang :thing/fields :thing/slug]

;; We've now found the path between :field/lang and :thing/slug, the only two
;; attrs in our route definition. So, we can stop looking in this case. But,
;; if there were more attrs in the route or if we hadn't found it, we could
;; simply add the adjacent attrs we just found to seen, and explore each of
;; those (via references) recursively...

[:field/lang :thing/fields :thing/slug]

(defn- ->sym [k] (symbol (str "?" (name k))))
(map vector (butlast full-path) (rest full-path))

;; Now that we have the path, we can construct a query from it:
;; TODO
(def query
'{:find [(pull ?e [{:thing/fields [:field/lang]}
:thing/slug
{:thing/_children ...}])]
:in [$]
:where [[?field :field/lang ?lang]
[?e :thing/fields ?field]
[?e :thing/slug ?slug]]})

;; TODO how do we go from :slugs => :thing/slug + {:thing/children ...} ?

;; Now we infer values from route-spec, and we have out list of uris...
;; TODO how do we get to lang?
(bread/infer-param :field/lang [{:thing/slug "two",
:thing/fields
[{:field/lang :en}
{:field/lang :fr}]}])
(map (fn [[thing]]
(map #(bread/infer-param % thing) route-spec)
)
(q query))

;; /experiment

(require '[kaocha.repl :as k])
Expand Down
Loading
Loading