Quellcode durchsuchen

add a button to remove optional values.

this does not clear the field, though.
Lucas Stadler vor 12 Jahren
Ursprung
Commit
3dd07e501d
1 geänderte Dateien mit 3 neuen und 0 gelöschten Zeilen
  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?}}))))