some tinkering on bulk link creation

neo4j-4
Josha von Gizycki 4 years ago
parent 56fc3dfe01
commit 3f2623d8b6

@ -283,6 +283,10 @@ form.inline {
} }
} }
form.no-grid {
display: block;
}
table { table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
@ -357,6 +361,7 @@ table {
button, input { button, input {
margin-right: @element-margin; margin-right: @element-margin;
margin-bottom: 0;
} }
} }

@ -131,9 +131,10 @@
(->> (domain-schema/accessible-schemas! (->> (domain-schema/accessible-schemas!
user-uuid) user-uuid)
(map (fn [schema] (map (fn [schema]
{:form (link-form! (:uuid schema)) {;; :form (link-form! (:uuid schema))
:schema schema})) :schema schema
(forms-inst/bulk-link-form)) :instances (domain/find-by-schema!
(:uuid schema))})))
req))) req)))
(defn route-create-bulk-link! [uuid req] (defn route-create-bulk-link! [uuid req]

@ -16,13 +16,26 @@
(h (:name instance)) (h (:name instance))
[:small " with..."]] [:small " with..."]]
(hform/form-to (hform/form-to
{:class "no-grid"}
[:post (path :instance-bulk-link-create instance)] [:post (path :instance-bulk-link-create instance)]
(anti-forgery-field) (anti-forgery-field)
(for [{:keys [schema form]} forms] (for [{:keys [schema instances]} forms]
[:fieldset (list
[:legend "Schema " [:strong (-> schema :name h)]] [:h2 "Schema " (h (:name schema))]
(form/render-widgets form [:label
nil "Link name "
req [:input {:name (str "name[" (:uuid schema) "]")}]]
{:render-anti-forgery-field? false})]) [:table
[:thead
[:tr
[:th "Selection"]
[:th "Name"]]]
[:tbody
(for [{:keys [name uuid]} instances]
[:tr
[:td {:style "text-align: center;"}
[:input {:type "checkbox"
:name (str "instances[" (:uuid schema) "]")
:value uuid}]]
[:td (h name)]])]]))
(hform/submit-button "Link!"))])) (hform/submit-button "Link!"))]))

Loading…
Cancel
Save