Skip to content

Instantly share code, notes, and snippets.

@Deraen
Last active August 29, 2015 14:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deraen/cf46b040730121266807 to your computer and use it in GitHub Desktop.
Save Deraen/cf46b040730121266807 to your computer and use it in GitHub Desktop.
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