Преглед на файлове

add a button to remove optional values.

this does not clear the field, though.
Lucas Stadler преди 12 години
родител
ревизия
3dd07e501d
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  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?}}))))