Clear all grubs on click
This commit is contained in:
parent
a3dc09b335
commit
cda4d2099e
1 changed files with 10 additions and 6 deletions
|
@ -99,7 +99,6 @@
|
||||||
|
|
||||||
(defn add-grub-on-enter [event add state owner]
|
(defn add-grub-on-enter [event add state owner]
|
||||||
(when (enter-pressed? event)
|
(when (enter-pressed? event)
|
||||||
(log "enter pressed:" (:new-grub state))
|
|
||||||
(add-grub add state owner)))
|
(add-grub add state owner)))
|
||||||
|
|
||||||
(defn handle-new-grub-change [event owner]
|
(defn handle-new-grub-change [event owner]
|
||||||
|
@ -132,8 +131,11 @@
|
||||||
[:ul#grub-list.list-group
|
[:ul#grub-list.list-group
|
||||||
(for [grub (sort-grubs grubs)]
|
(for [grub (sort-grubs grubs)]
|
||||||
(om/build grub-view grub))]
|
(om/build grub-view grub))]
|
||||||
[:button.btn.hidden.pull-right
|
[:button.btn.pull-right
|
||||||
{:id "clear-all-btn" :type "button"}
|
{:id "clear-all-btn"
|
||||||
|
:class (when (empty? grubs) "hidden")
|
||||||
|
:type "button"
|
||||||
|
:on-click #(put! (:clear-all (om/get-shared owner)) {:event :clear-all-grubs})}
|
||||||
"Clear all"]])))))
|
"Clear all"]])))))
|
||||||
|
|
||||||
(defn app-view [state owner]
|
(defn app-view [state owner]
|
||||||
|
@ -149,10 +151,12 @@
|
||||||
(om/build recipes-view (:recipes state))]]]))))
|
(om/build recipes-view (:recipes state))]]]))))
|
||||||
|
|
||||||
(defn render-app [state]
|
(defn render-app [state]
|
||||||
(let [out (chan)
|
(let [add (chan)
|
||||||
add out]
|
clear-all (chan)
|
||||||
|
out (a/merge [add clear-all])]
|
||||||
(om/root app-view
|
(om/root app-view
|
||||||
state
|
state
|
||||||
{:target (.getElementById js/document "container")
|
{:target (.getElementById js/document "container")
|
||||||
:shared {:add add}})
|
:shared {:add add
|
||||||
|
:clear-all clear-all}})
|
||||||
out))
|
out))
|
||||||
|
|
Loading…
Reference in a new issue