|
|
|
@ -38,7 +38,8 @@
|
|
|
|
|
(hform/label field-id (:label field-def))))
|
|
|
|
|
|
|
|
|
|
(defn input-widget [id def value]
|
|
|
|
|
(hform/text-field {:required (or (:required def) false)}
|
|
|
|
|
(hform/text-field (merge {:required (or (:required def) false)}
|
|
|
|
|
(:attrs def))
|
|
|
|
|
id
|
|
|
|
|
value))
|
|
|
|
|
|
|
|
|
@ -49,7 +50,8 @@
|
|
|
|
|
value))
|
|
|
|
|
|
|
|
|
|
(defn textarea-widget [id def value]
|
|
|
|
|
(hform/text-area {:required (or (:required def) false)}
|
|
|
|
|
(hform/text-area (merge {:required (or (:required def) false)}
|
|
|
|
|
(:attrs def))
|
|
|
|
|
id
|
|
|
|
|
value))
|
|
|
|
|
|
|
|
|
@ -59,19 +61,19 @@
|
|
|
|
|
value))
|
|
|
|
|
|
|
|
|
|
(defn multiselect-widget [id def value]
|
|
|
|
|
(let [options (:options def)]
|
|
|
|
|
[:select {:multiple "multiple"
|
|
|
|
|
:size (:size def 5)
|
|
|
|
|
:name (name id)
|
|
|
|
|
:id (name id)}
|
|
|
|
|
(for [option options]
|
|
|
|
|
[:option {:value (second option)
|
|
|
|
|
:selected (some? (some (partial = (second option))
|
|
|
|
|
value))}
|
|
|
|
|
(hcore/h (first option))])]))
|
|
|
|
|
[:select (merge {:multiple "multiple"
|
|
|
|
|
:size (:size def 5)
|
|
|
|
|
:name (name id)
|
|
|
|
|
:id (name id)}
|
|
|
|
|
(:attrs def))
|
|
|
|
|
(for [option (:options def)]
|
|
|
|
|
[:option {:value (second option)
|
|
|
|
|
:selected (some? (some (partial = (second option))
|
|
|
|
|
value))}
|
|
|
|
|
(hcore/h (first option))])])
|
|
|
|
|
|
|
|
|
|
(comment
|
|
|
|
|
(multiselect-widget :id {:options [["<>" "key"]]} {}))
|
|
|
|
|
|
|
|
|
|
(defn hidden-widget [id def value]
|
|
|
|
|
(defn hidden-widget [id _ value]
|
|
|
|
|
(hform/hidden-field id value))
|
|
|
|
|