From 0cf9596f87cd85dd05742dedfa99b4508abb3743 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Wed, 16 Oct 2019 16:38:43 +0200 Subject: [PATCH] more elegant no-anti-forgery-field-rendering --- project.clj | 2 +- src/wanijo/instance/forms.clj | 4 ++-- src/wanijo/instance/view/bulk_link_selection.clj | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/project.clj b/project.clj index 3370e61..679e53f 100644 --- a/project.clj +++ b/project.clj @@ -18,7 +18,7 @@ commons-codec]] [ring/ring-json "0.5.0"] [hiccup "1.0.5"] - [joshavg/formulare "0.5.0-SNAPSHOT"] + [joshavg/formulare "0.6.0"] ;; compojure uses old transitive dependencies of ring ;; specifiy them here explicitly so newer versions diff --git a/src/wanijo/instance/forms.clj b/src/wanijo/instance/forms.clj index c1cbae0..1103c2a 100644 --- a/src/wanijo/instance/forms.clj +++ b/src/wanijo/instance/forms.clj @@ -19,8 +19,8 @@ (defn bulk-link-form [link-forms] (map (fn [{:keys [schema form]}] - (let [name-field (keyword (str "name-" (:uuid schema))) - instances-field (keyword (str "instances-" (:uuid schema)))] + (let [name-field (keyword (str "name[" (:uuid schema) "]")) + instances-field (keyword (str "instances[" (:uuid schema) "]"))] {:schema schema :form (-> form (assoc-in [:fields name-field] diff --git a/src/wanijo/instance/view/bulk_link_selection.clj b/src/wanijo/instance/view/bulk_link_selection.clj index 8248ce9..5b77f6a 100644 --- a/src/wanijo/instance/view/bulk_link_selection.clj +++ b/src/wanijo/instance/view/bulk_link_selection.clj @@ -7,6 +7,7 @@ [ring.util.anti-forgery :refer [anti-forgery-field]])) (defn bulk-link-selection [instance forms req] + (clojure.pprint/pprint forms) (view/layout :request req :content @@ -20,6 +21,8 @@ (for [{:keys [schema form]} forms] [:fieldset [:legend "Schema " [:strong (-> schema :name h)]] - (rest - (form/render-widgets form nil req))]) + (form/render-widgets form + nil + req + {:render-anti-forgery-field? false})]) (hform/submit-button "Link!"))]))