Skip to content

Instantly share code, notes, and snippets.

@alandipert
Created August 29, 2016 19:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alandipert/9f5a64858eb244dec78d2a9238ad0152 to your computer and use it in GitHub Desktop.
Save alandipert/9f5a64858eb244dec78d2a9238ad0152 to your computer and use it in GitHub Desktop.
toggle visibility
(page "index.html")
(defc people
[{:name "Alan"
:age 32
:nickname "Coolpants"}
{:name "Felix the Cat"
:age 8
:nickname "Cuddles"}
{:name "Steve"
:age 11
:nickname "Psycho"}])
(html
(head)
(body
(button :click #(swap! people conj {:name (str (gensym)) :age (rand-int 100) :nickname (gensym)})
"Add")
(button :click #(swap! people pop)
"Pop")
(ul
(for-tpl [person people]
(let [details? (cell (do (println "made a cell") false))]
(li :click #(swap! details? not)
(span (text "Name: ~(:name person)"))
(pre :toggle details? (cell= (pr-str person)))))))))
@beatngu13
Copy link

Works like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment