clojure icon indicating copy to clipboard operation
clojure copied to clipboard

portal submit custom logic

Open practicalli-johnny opened this issue 2 years ago • 0 comments

Portal submit can include custom code

useful for values that don't support metadata directly but where you still want to customize display

Example conditionally add date

(defn ->date [value]
  ^{:portal.viewer/default :portal.viewer/hiccup}
  [:portal.viewer/relative-time value])

(defn my-submit [value]
  (p/submit
   (cond
     (date? value)
     (->date value)
     :else value)))

(add-tap #'my-submit)

Reference

practicalli-johnny avatar May 22 '23 16:05 practicalli-johnny