This commit is contained in:
Dan Holmsand 2015-09-08 08:38:45 +02:00
parent 7224dd77df
commit 0c89f3864e
3 changed files with 17 additions and 11 deletions

View File

@ -28,13 +28,14 @@
;; (tools/register-page news-page [#'news/main]
;; "Reagent news")
(defroute "/" [] (dispatch [:content [#'intro/main]]))
(def title "Minimalistic React for ClojureScript")
(defroute "/" []
(dispatch [:content [#'intro/main] title]))
(defroute main-page "/index.html" []
(dispatch [:content [#'intro/main] "Minimalistic React for ClojureScript"]))
(defroute news-page "/news/index.html" []
(dispatch [:content [#'news/main] "News"]))
(dispatch [:content [#'intro/main] title]))
(tools/reg-page (main-page))
(tools/reg-page (news-page))
(defn demo []
[:div
@ -42,7 +43,7 @@
[:ul.nav
[:li.brand [link {:href (main-page)} "Reagent:"]]
[:li [link {:href (main-page)} "Intro"]]
[:li [link {:href (news-page)} "News"]]
[:li [link {:href (news/path)} "News"]]
[:li [:a github "GitHub"]]]]
@test-results
[tools/page-content]

View File

@ -3,7 +3,9 @@
[reagentdemo.news.async :as async]
[reagentdemo.news.undodemo :as undodemo]
[reagentdemo.news.clockpost :as clock]
[reagentdemo.news.news050 :as news050]))
[reagentdemo.news.news050 :as news050]
[sitetools.core :as tools :refer [dispatch link]]
[secretary.core :as secretary :refer-macros [defroute]]))
(defn main []
[:div
@ -12,3 +14,7 @@
[anyargs/main {:summary true}]
[async/main {:summary true}]
[undodemo/main {:summary true}]])
(defroute path "/news/index.html" []
(dispatch [:content [#'main] "News"]))
(tools/reg-page (path))

View File

@ -14,9 +14,8 @@
(defn rswap! [a f & args]
;; Roughly like swap!, except that recursive swaps are ok
(let [fs (if-some [arr (.-rswapfs a)]
arr
(set! (.-rswapfs a) (array)))]
(let [fs (or (.-rswapfs a)
(set! (.-rswapfs a) (array)))]
(.push fs #(apply f % args))
(if (< 1 (.-length fs))
nil
@ -73,7 +72,7 @@
state))
(defn dispatch [event]
(dbg event)
;; (dbg event)
(rswap! config demo-handler event)
nil)