Explorar el Código

add a button to remove optional values.

this does not clear the field, though.
Lucas Stadler %!s(int64=12) %!d(string=hace) años
padre
commit
3dd07e501d
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      clj/clarity/cljs/clarity.cljs

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

145
(defn make-typed-field [m optional?]
145
(defn make-typed-field [m optional?]
146
  (fn [[k t]]
146
  (fn [[k t]]
147
    (dom/div #js {:className "field"}
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
      (dom/label nil (str k (when optional? " (optional)")))
151
      (dom/label nil (str k (when optional? " (optional)")))
149
      (om/build make-typed-input m {:opts {:type (om/value t), :key k, :val (k m)
152
      (om/build make-typed-input m {:opts {:type (om/value t), :key k, :val (k m)
150
                                           :optional? optional?}}))))
153
                                           :optional? optional?}}))))