|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
(ns wanijo.schema.view
|
|
|
|
|
(:require [hiccup.form :as hform]
|
|
|
|
|
[ring.util.anti-forgery :refer [anti-forgery-field]]
|
|
|
|
|
[formulare.core :as form]
|
|
|
|
|
[wanijo.framework.view :as view]
|
|
|
|
|
[wanijo.framework.form :as form]
|
|
|
|
|
[wanijo.framework.routing :refer [path]]
|
|
|
|
|
[wanijo.framework.time :refer [prettify-dt]]
|
|
|
|
|
[wanijo.schema.domain :as domain]
|
|
|
|
@ -11,7 +11,9 @@
|
|
|
|
|
(def form
|
|
|
|
|
{:fields {:name {:label "Name"
|
|
|
|
|
:required true
|
|
|
|
|
:spec ::domain/name}}})
|
|
|
|
|
:spec ::domain/name}
|
|
|
|
|
:uuid {:label ""
|
|
|
|
|
:widget :hidden}}})
|
|
|
|
|
|
|
|
|
|
(def attr-form
|
|
|
|
|
{:fields {:name {:label "Name"
|
|
|
|
@ -27,13 +29,16 @@
|
|
|
|
|
:required {:label "Required"
|
|
|
|
|
:required false
|
|
|
|
|
:spec ::attr-domain/required
|
|
|
|
|
:widget :checkbox}}})
|
|
|
|
|
:widget :checkbox}
|
|
|
|
|
:uuid {:widget :hidden}}})
|
|
|
|
|
|
|
|
|
|
(def assign-form
|
|
|
|
|
{:fields {:assigned {:label "Users"
|
|
|
|
|
:required false
|
|
|
|
|
:spec ::domain/assigned-to
|
|
|
|
|
:widget :mselect}}})
|
|
|
|
|
:widget :mselect}
|
|
|
|
|
:uuid {:label ""
|
|
|
|
|
:widget :hidden}}})
|
|
|
|
|
|
|
|
|
|
(defn overview! [req]
|
|
|
|
|
(let [session (:session req)
|
|
|
|
@ -70,12 +75,10 @@
|
|
|
|
|
[:h2 "Edit"]
|
|
|
|
|
(hform/form-to [:post (path :schema-edit)]
|
|
|
|
|
(form/render-widgets form schema req)
|
|
|
|
|
(hform/hidden-field "uuid" (:uuid schema))
|
|
|
|
|
(hform/submit-button "Edit"))
|
|
|
|
|
[:h3 "Assign to users"]
|
|
|
|
|
(hform/form-to [:post (path :schema-assign)]
|
|
|
|
|
(form/render-widgets assign-form schema req)
|
|
|
|
|
(hform/hidden-field "uuid" (:uuid schema))
|
|
|
|
|
(hform/submit-button "Assign"))
|
|
|
|
|
[:h2 "Attributes"]
|
|
|
|
|
[:ul.schema-attributes
|
|
|
|
@ -83,7 +86,6 @@
|
|
|
|
|
[:li
|
|
|
|
|
(hform/form-to [:post (path :attribute-edit {:schema (:uuid schema)})]
|
|
|
|
|
(form/render-widgets attr-form attr req)
|
|
|
|
|
(hform/hidden-field "uuid" (:uuid attr))
|
|
|
|
|
(hform/submit-button "Save"))
|
|
|
|
|
(hform/form-to [:delete (path :attribute-delete attr)]
|
|
|
|
|
(anti-forgery-field)
|
|
|
|
|