Просмотр исходного кода

add a button to remove optional values.

this does not clear the field, though.
Lucas Stadler лет назад: 12
Родитель
Сommit
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?}}))))