small refactorings, inline svg

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

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

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

Loading…
Cancel
Save