Dropdown works well
This commit is contained in:
@@ -1,15 +1,42 @@
|
||||
(ns auto-ap.ssr.hx
|
||||
(:require [cheshire.core :as cheshire]
|
||||
[clojure.string :as str]
|
||||
[auto-ap.ssr.hiccup-helper :as hh]))
|
||||
(:require [auto-ap.ssr.hiccup-helper :as hh]
|
||||
[cheshire.core :as cheshire]
|
||||
[cheshire.generate :refer [add-encoder]]
|
||||
[clojure.string :as str]))
|
||||
|
||||
|
||||
(defn vals [m]
|
||||
(cheshire/generate-string m))
|
||||
|
||||
(deftype jsfn [body name])
|
||||
|
||||
(defn jsf [t jq]
|
||||
(.writeString jq (str "__" (.-name t) "__" (.-body t) "__end__")))
|
||||
|
||||
(add-encoder jsfn jsf)
|
||||
|
||||
|
||||
(defn json [m]
|
||||
(cheshire/generate-string m))
|
||||
(let [starting-point (cheshire/generate-string m)]
|
||||
(if (map? m)
|
||||
(reduce
|
||||
(fn [starting-point [k v]]
|
||||
(if (instance? jsfn v)
|
||||
(-> (str/replace starting-point (re-pattern (str "(?s)\"__" (.-name v) "__(.*?)__end__\"")) "$1" )
|
||||
(str/replace "\\n" "\n"))
|
||||
starting-point))
|
||||
starting-point
|
||||
m)
|
||||
starting-point)))
|
||||
|
||||
(defn random-alpha-string []
|
||||
(let [alpha-chars (concat (map char (range 65 91)) ; A-Z
|
||||
(map char (range 97 123))) ; a-z
|
||||
random-char (fn [] (rand-nth alpha-chars))]
|
||||
(apply str (repeatedly 10 random-char))))
|
||||
|
||||
(defn js-fn [s]
|
||||
(jsfn. s (random-alpha-string)))
|
||||
|
||||
(defn trigger-field-change [& {:keys [name
|
||||
from]}]
|
||||
|
||||
Reference in New Issue
Block a user