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