Safety commit

Ran out of electricity last night when I'd almost but not quite got creation working properly. Frustrating! I don't have much electricity this morning so I'm pushing this up to GitHub for safety.
This commit is contained in:
Simon Brooke 2018-08-06 09:32:42 +01:00
parent ba1be5dc2e
commit 7280c6f41b
2 changed files with 27 additions and 2 deletions

View file

@ -1,6 +1,6 @@
(ns adl-support.forms-support
(:require [adl-support.core :refer [do-or-log-error do-or-return-reason]]
[adl-support.utils :refer [safe-name singularise]]
[adl-support.utils :refer [descendants-with-tag safe-name singularise]]
[clojure.core.memoize :as memo]
[clojure.data.json :as json]
[clojure.java.io :as io]
@ -103,3 +103,10 @@
(reduce {} (map #(hash-map (keyword %) nil) ~fields))
~params))
(defn property-defaults
[entity]
(reduce
merge {}
(map
#(hash-map (keyword (-> % :attrs :name)) (-> % :attrs :default))
(descendants-with-tag entity :property #(-> % :attrs :default)))))