Skip to content

Instantly share code, notes, and snippets.

@Deraen

Deraen/silk-data.cljs

Last active Aug 29, 2015
Embed
What would you like to do?
Additional data to Silk routes
(deftype AdditionalData [data]
silk/Pattern
(-match [_ _]
data)
(-unmatch [_ _]
nil)
(-match-validator [_]
(constantly true))
(-unmatch-validators [_]
{}))
(defn data [x]
(AdditionalData. x))
(def routes
(silk/routes
[[:index [[]]]
[:profile [["profile"]]]
[:my-group [["group"]]]
[:users [["users"]]]
[:groups [["groups"]]]
;; Used to in nav-bar to mark link active
[:dashboard [["dashboard"] (data {:routing/nav :issue})]]
[:new-issue [["new-issue"] (data {:routing/nav :issue})]]
[:issue [["issue" :id] (data {:routing/nav :issue})]]
;; Used to allow access without login
[:token-view [["token" :id] (data {:public? true})]]
[:register-view [["register"] (data {:public? true})]]
[:password-forgotten-view [["password-forgotten"] (data {:public? true})]]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment