Created
November 27, 2011 18:16
-
-
Save ibdknox/1397925 to your computer and use it in GitHub Desktop.
example of specialized defpage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro mainpage [route params & body] | |
`(defpage ~route ~params | |
(common/main-layout | |
~@body))) | |
;;Or if you wanted to get really crazy, so that you don't have to duplicate that macro | |
;;you could write a macro that writes the macros for you: | |
(defmacro layout-page [name layout] | |
`(defmacro ~name [route# params# & body#] | |
(concat `(defpage ~route# ~params#) | |
[(conj `(~@body#) | |
~layout)]))) | |
(layout-page adminpage common/admin-layout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment