|
|
|
@ -9,22 +9,22 @@
|
|
|
|
|
[wanijo.attribute.domain :as attr-domain]))
|
|
|
|
|
|
|
|
|
|
(def new-form
|
|
|
|
|
{:fields {:schema-name {:label "Nimi"
|
|
|
|
|
{:fields {:schema-name {:label "Name"
|
|
|
|
|
:required true
|
|
|
|
|
:spec ::domain/name}}})
|
|
|
|
|
|
|
|
|
|
(def new-attr-form
|
|
|
|
|
{:fields {:name {:label "Nimi"
|
|
|
|
|
{:fields {:name {:label "Name"
|
|
|
|
|
:required true
|
|
|
|
|
:spec ::attr-domain/name}
|
|
|
|
|
:type {:label "Tomo"
|
|
|
|
|
:type {:label "Type"
|
|
|
|
|
:required true
|
|
|
|
|
:spec ::attr-domain/type
|
|
|
|
|
:options [["Lon e lipu" "string"]
|
|
|
|
|
["Ali lon e lipu" "text"]
|
|
|
|
|
["Kama" "date"]
|
|
|
|
|
["Sitelen" "file"]]}
|
|
|
|
|
:required {:label "Wile"
|
|
|
|
|
:options [["String" "string"]
|
|
|
|
|
["Text" "text"]
|
|
|
|
|
["Date" "date"]
|
|
|
|
|
["File" "file"]]}
|
|
|
|
|
:required {:label "Required"
|
|
|
|
|
:required false
|
|
|
|
|
:spec ::attr-domain/required}}})
|
|
|
|
|
|
|
|
|
@ -35,12 +35,12 @@
|
|
|
|
|
(view/layout!
|
|
|
|
|
:session session
|
|
|
|
|
:content
|
|
|
|
|
[[:h1 "Ali jaki ijo"]
|
|
|
|
|
[[:h1 "All schemas"]
|
|
|
|
|
[:table
|
|
|
|
|
[:thead
|
|
|
|
|
[:tr
|
|
|
|
|
[:th "Nimi"]
|
|
|
|
|
[:th "Tenpo kama"]]]
|
|
|
|
|
[:th "Name"]
|
|
|
|
|
[:th "Created"]]]
|
|
|
|
|
[:tbody
|
|
|
|
|
(for [schema schemas]
|
|
|
|
|
[:tr
|
|
|
|
@ -49,33 +49,33 @@
|
|
|
|
|
(:name schema)]]
|
|
|
|
|
[:td
|
|
|
|
|
(prettify-dt (:created_at schema))]])]]
|
|
|
|
|
[:h1 "Pali sin e jaki ijo"]
|
|
|
|
|
[:h1 "New schema"]
|
|
|
|
|
(hform/form-to [:post (path :schema-new)]
|
|
|
|
|
(anti-forgery-field)
|
|
|
|
|
(form/field new-form :schema-name req)
|
|
|
|
|
(hform/submit-button "Pali"))])))
|
|
|
|
|
(hform/submit-button "Create"))])))
|
|
|
|
|
|
|
|
|
|
(defn show-schema! [schema attrs req]
|
|
|
|
|
(view/layout!
|
|
|
|
|
:session (:session req)
|
|
|
|
|
:content
|
|
|
|
|
[[:h1 "Jaki ijo "
|
|
|
|
|
[[:h1 "Schema "
|
|
|
|
|
[:span.schema-title__name (:name schema)]]
|
|
|
|
|
(hform/form-to [:post "/schema/edit"])
|
|
|
|
|
[:h2 "Lili wan e jaki ijo"]
|
|
|
|
|
[:h2 "Attributes"]
|
|
|
|
|
[:ul
|
|
|
|
|
(for [attr attrs]
|
|
|
|
|
[:li (:name attr)])]
|
|
|
|
|
[:h3 "Pali lili wan"]
|
|
|
|
|
[:h3 "New attribute"]
|
|
|
|
|
(hform/form-to [:post (path :attribute-new)]
|
|
|
|
|
(anti-forgery-field)
|
|
|
|
|
(hform/hidden-field "schema" (:uuid schema))
|
|
|
|
|
(form/field new-attr-form :name req)
|
|
|
|
|
(form/drop-down new-attr-form :type req)
|
|
|
|
|
(form/check-box new-attr-form :required req)
|
|
|
|
|
(hform/submit-button "Pali"))
|
|
|
|
|
[:h2 "Mute pali"]
|
|
|
|
|
(hform/submit-button "Save"))
|
|
|
|
|
[:h2 "Actions"]
|
|
|
|
|
(hform/form-to {:class "inline"}
|
|
|
|
|
[:delete (path :schema-delete schema)]
|
|
|
|
|
(anti-forgery-field)
|
|
|
|
|
(hform/submit-button "Pakala!"))]))
|
|
|
|
|
(hform/submit-button "Delete!"))]))
|
|
|
|
|