Pārlūkot izejas kodu

add a button to remove optional values.

this does not clear the field, though.
Lucas Stadler 12 gadi atpakaļ
vecāks
revīzija
3dd07e501d
1 mainītis faili ar 3 papildinājumiem un 0 dzēšanām
  1. 3 0
      clj/clarity/cljs/clarity.cljs

+ 3 - 0
clj/clarity/cljs/clarity.cljs

@ -145,6 +145,9 @@
145 145
(defn make-typed-field [m optional?]
146 146
  (fn [[k t]]
147 147
    (dom/div #js {:className "field"}
148
      (when optional?
149
        (dom/input #js {:type "button", :value "-",
150
                        :onClick (fn [_] (om/update! m dissoc k))}))
148 151
      (dom/label nil (str k (when optional? " (optional)")))
149 152
      (om/build make-typed-input m {:opts {:type (om/value t), :key k, :val (k m)
150 153
                                           :optional? optional?}}))))