fix dropdown

This commit is contained in:
BC
2019-02-19 19:04:16 -08:00
parent 76f460c52c
commit 0ded06b26e
2 changed files with 38 additions and 21 deletions

View File

@@ -28,6 +28,7 @@
(re-frame/reg-event-fx
::toggle-expense-accounts
(fn [{:keys [db] } [_ invoice-id]]
(println "toggling")
{:db
(update-in db [::visible-expense-accounts] (fn [i] (if (= i invoice-id) nil invoice-id) ))}))
@@ -169,14 +170,15 @@
[:div.dropdown.is-right {:class (if (= id visible-expense-accounts)
"is-active"
"")}
"")
:on-blur (dispatch-event [::toggle-expense-accounts id])
:on-focus (dispatch-event [::toggle-expense-accounts id])}
[:div.dropdown-trigger
[:a.button.badge {:data-badge (str (clojure.core/count expense-accounts))
:aria-haspopup true
:tab-index "0"
:on-blur (delayed-dispatch [::toggle-expense-accounts id])
:on-focus (dispatch-event [::toggle-expense-accounts id])
} "Accounts"]]
[:div.dropdown-menu {:role "menu"}
[:div.dropdown-content
@@ -187,7 +189,7 @@
[:hr.dropdown-divider]
(when expense-event
[:a.dropdown-item.is-primary {:on-click (dispatch-event (conj expense-event i))} "Change"])]]])
[:a.dropdown-item.is-primary {:on-click (fn [x] (println "here"))#_(dispatch-event (conj expense-event i))} "Change"])]]])
[:span {:style {:margin-left "1em"}}]
(when (and on-edit-invoice (not= ":voided" (:status i)))
[:a.button {:on-click (fn [] (on-edit-invoice i))} [:span.icon [:i.fa.fa-pencil]]])