more elegant no-anti-forgery-field-rendering

neo4j-4
Josha von Gizycki 5 years ago
parent 39e677c2f9
commit 0cf9596f87

@ -18,7 +18,7 @@
commons-codec]] commons-codec]]
[ring/ring-json "0.5.0"] [ring/ring-json "0.5.0"]
[hiccup "1.0.5"] [hiccup "1.0.5"]
[joshavg/formulare "0.5.0-SNAPSHOT"] [joshavg/formulare "0.6.0"]
;; compojure uses old transitive dependencies of ring ;; compojure uses old transitive dependencies of ring
;; specifiy them here explicitly so newer versions ;; specifiy them here explicitly so newer versions

@ -19,8 +19,8 @@
(defn bulk-link-form [link-forms] (defn bulk-link-form [link-forms]
(map (fn [{:keys [schema form]}] (map (fn [{:keys [schema form]}]
(let [name-field (keyword (str "name-" (:uuid schema))) (let [name-field (keyword (str "name[" (:uuid schema) "]"))
instances-field (keyword (str "instances-" (:uuid schema)))] instances-field (keyword (str "instances[" (:uuid schema) "]"))]
{:schema schema {:schema schema
:form (-> form :form (-> form
(assoc-in [:fields name-field] (assoc-in [:fields name-field]

@ -7,6 +7,7 @@
[ring.util.anti-forgery :refer [anti-forgery-field]])) [ring.util.anti-forgery :refer [anti-forgery-field]]))
(defn bulk-link-selection [instance forms req] (defn bulk-link-selection [instance forms req]
(clojure.pprint/pprint forms)
(view/layout (view/layout
:request req :request req
:content :content
@ -20,6 +21,8 @@
(for [{:keys [schema form]} forms] (for [{:keys [schema form]} forms]
[:fieldset [:fieldset
[:legend "Schema " [:strong (-> schema :name h)]] [:legend "Schema " [:strong (-> schema :name h)]]
(rest (form/render-widgets form
(form/render-widgets form nil req))]) nil
req
{:render-anti-forgery-field? false})])
(hform/submit-button "Link!"))])) (hform/submit-button "Link!"))]))

Loading…
Cancel
Save