Skip to content

Instantly share code, notes, and snippets.

@ibdknox
Created June 21, 2011 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibdknox/1038952 to your computer and use it in GitHub Desktop.
Save ibdknox/1038952 to your computer and use it in GitHub Desktop.
get started step 2
(defpartial todo-item [{:keys [id title due]}]
[:li {:id id} ;; maps define HTML attributes
[:h3 title]
[:span.due due]]) ;; add a class
(defpartial todos-list [items]
[:ul#todoItems ;; set the id attribute
(map todo-item items)])
(todos-list [{:id "todo1"
:title "Get Milk"
:due "today"}])
;; =>
;; <ul id="todoItems">
;; <li id="todo1">
;; <h3>Get Milk</h3>
;; <span class="due">today</span>
;; </li>
;; </ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment