small refactorings, inline svg

integration-tests
Josha von Gizycki 6 years ago
parent 0d8cb6e1c1
commit 7e024e99ab

@ -34,32 +34,31 @@
(:params req))))
(list! schema-uuid req))))
(defn form! [uuid]
(forms-inst/with-attributes
(domain-attr/find-by-instance! uuid)))
(defn instance! [uuid]
(domain/full-instance-by-uuid! uuid))
(defn show! [uuid req]
(view/show! (instance! uuid) req))
(defn form! [uuid attrs]
(forms-inst/with-attributes attrs))
(defn edit-form! [uuid req]
(let [instance (instance! uuid)
attrs (domain-attr/find-by-instance! uuid)
user-uuid (get-in req [:session :uuid])]
(view/edit! instance
(form! uuid)
(form! uuid attrs)
(forms-inst/instance->form-data instance)
(domain-schema/accessible-schemas! user-uuid)
req)))
(defn edit! [uuid req]
(let [form-def (form! uuid)
(let [attrs (domain-attr/find-by-instance! uuid)
form-def (form! uuid attrs)
instance (instance! uuid)]
(if (form/valid? form-def req)
(let [form-data (form/form-data form-def req)
attrs (domain-attr/find-by-instance! uuid)
form-instance (forms-inst/form-data->instance form-data attrs)
instance (assoc form-instance :uuid uuid)]
(domain/edit! instance)

@ -6,6 +6,7 @@
[markdown.core :as md]
[formulare.core :as form]
[wanijo.instance.domain :as domain]
[wanijo.visualisation.viz :as viz]
[wanijo.framework
[view :as view]
[routing :refer [path]]
@ -71,8 +72,7 @@
(seq (:links-in instance)))
[:section.visualisation
[:h2 "Visualisation"]
[:image {:src (path :vis-single-instance instance)
:alt "SVG Visualisation"}]])
(viz/single-instance instance)])
(when (seq (:links-out instance))
[:section.links-out
[:h2 "Outgoing Links"]

Loading…
Cancel
Save