show-schema

integration-tests
Josha von Gizycki 7 years ago
parent 82cd9ed367
commit 691e1fa6d2

@ -12,7 +12,7 @@ body {
a:link,
a:visited {
color: #555;
color: #115577;
text-decoration: none;
}

@ -42,3 +42,17 @@
:s_uuid (neo4j/uuid)})
first
:uuid))
(neo4j/defquery
find-by-id!
"MATCH (s:schema)
WHERE s.uuid = {uuid}
RETURN s")
(defn find-by-uuid! [uuid]
(->>
(neo4j/exec-query
find-by-id!
{:uuid uuid})
first
:s))

@ -6,7 +6,7 @@
[wanijo.schema.domain :as domain]
[wanijo.schema.view :as view-schema]))
(defn- new! [req]
(defn new! [req]
(if (form/valid? view-schema/new-form req)
(do
(domain/create-new!
@ -15,6 +15,13 @@
(resp/redirect "/schema"))
(view-schema/overview! req)))
(defn show-schema! [uuid session]
(println uuid session)
(view-schema/show-schema!
(domain/find-by-uuid! uuid)
session))
(defroutes schema-routes
(GET "/schema" [] view-schema/overview!)
(GET "/schema/:uuid" [uuid :as req] (show-schema! uuid (:session req)))
(POST "/schema/new" [] new!))

@ -15,22 +15,30 @@
uuid (:uuid session)
schemas (domain/all-created-by! uuid)]
(view/layout!
:session session
:content
[[:h1 "Ali jaki ijo"]
[:table
[:thead
[:tr
[:th "Nimi"]
[:th "Tenpo kama"]]]
[:tbody
(for [schema schemas]
[:tr
[:td (:name schema)]
[:td (:created_at schema)]])]]
[:h1 "Pali sin e jaki ijo"]
(hform/form-to
[:post "/schema/new"]
(form/field new-form :schema-name req)
(hform/submit-button "Pali")
(anti-forgery-field))])))
:session session
:content
[[:h1 "Ali jaki ijo"]
[:table
[:thead
[:tr
[:th "Nimi"]
[:th "Tenpo kama"]]]
[:tbody
(for [schema schemas]
[:tr
[:td
[:a {:href (str "/schema/" (:uuid schema))}
(:name schema)]]
[:td (:created_at schema)]])]]
[:h1 "Pali sin e jaki ijo"]
(hform/form-to
[:post "/schema/new"]
(form/field new-form :schema-name req)
(hform/submit-button "Pali")
(anti-forgery-field))])))
(defn show-schema! [schema session]
(view/layout!
:session session
:content
[[:h1 "Jaki ijo " (:name schema)]]))

Loading…
Cancel
Save