Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/om_bootstrap/input.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
{(s/optional-key :type) s/Str
(s/optional-key :label) s/Str
(s/optional-key :skip-form-group?) (s/named s/Bool "DON'T render a wrapping form group?")
(s/optional-key :disabled) s/Bool
(s/optional-key :help) s/Str
(s/optional-key :group-classname) s/Str
(s/optional-key :wrapper-classname) s/Str
Expand Down Expand Up @@ -120,10 +121,11 @@

(s/defn checkbox-or-radio-wrapper :- t/Component
"Wraps this business in a div."
[{type :type} :- Input
[{type :type disabled :disabled} :- Input
children]
(let [klasses {:checkbox (= "checkbox" type)
:radio (= "radio" type)}]
:radio (= "radio" type)
:disabled disabled}]
(d/div {:class (class-set klasses)}
children)))

Expand Down Expand Up @@ -185,7 +187,8 @@
the default values or validation messages that we'll need to make
this work, though."
[opts :- Input & children]
(let [[input attrs] (t/separate Input opts)]
(let [[input props] (t/separate Input opts)
attrs (assoc props :disabled (:disabled input))]
(if (checkbox-or-radio? input)
(->> [(->> (render-input input attrs children)
(render-label input)
Expand Down