first step of page abstraction.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
(ns auto-ap.forms
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[re-frame.interceptor :as i]
|
||||
[auto-ap.status :as status]
|
||||
[auto-ap.views.utils :refer [dispatch-event bind-field]]))
|
||||
|
||||
|
||||
@@ -198,10 +199,11 @@
|
||||
^{:key error}
|
||||
[:div.notification.is-warning.animated.fadeInUp {} error]))
|
||||
:submit-button (fn [child]
|
||||
(let [error (:error @(re-frame/subscribe [::form id]))]
|
||||
[:button.button.is-medium.is-primary.is-fullwidth {:disabled (if @(re-frame/subscribe can-submit)
|
||||
""
|
||||
"disabled")
|
||||
:class (str @(re-frame/subscribe [::loading-class id])
|
||||
(when error " animated shake"))} child]))})
|
||||
(let [error (:error @(re-frame/subscribe [::form id]))
|
||||
status @(re-frame/subscribe [::status/single id])
|
||||
can-submit @(re-frame/subscribe can-submit)]
|
||||
[:button.button.is-medium.is-primary.is-fullwidth {:disabled (or (status/disabled-for status)
|
||||
(not can-submit))
|
||||
:class (status/class-for status) }
|
||||
child]))})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user