create attributes, switch back to english in ui, fixes

integration-tests
Josha von Gizycki 6 years ago
parent 37c42d94ac
commit 5cd55676fc

@ -8,7 +8,7 @@
(spec/def ::type
(spec/and
string?
#(some #{"date" "file" "string" "text"} %)))
#(some (partial = %) ["date" "file", "string" "text"])))
(spec/def ::required
(spec/or :bool-val boolean?
@ -42,6 +42,6 @@
(neo4j/exec-query!
create-new
{:user_uuid user-uuid
:schem_uuid schema-uuid
:schema_uuid schema-uuid
:type type
:name name}))

@ -16,8 +16,7 @@
(get-in req [:params :type])
schema-uuid
(get-in req [:session :uuid]))
(resp/redirect (path :schema-show
schema-uuid)))
(resp/redirect (path :schema-show {:uuid schema-uuid})))
(view-schema/show-schema!
(domain-schema/find-by-uuid! schema-uuid)
(domain/find-by-schema! schema-uuid)

@ -41,7 +41,7 @@
(defn field
([form-def field-id req]
(field form-def field-id req
(get-in req [:params field])))
(get-in req [:params field-id])))
([form-def field-id req field-value]
{:pre [(spec/valid? ::form form-def)]}
(let [field-def (get-in form-def [:fields field-id])

@ -2,9 +2,13 @@
(:require [neo4j-clj.core :as db]
[wanijo.framework.devmode :as devmode]
[clj-time.format :as time-format]
[clj-time.local :as time-local])
[clj-time.local :as time-local]
[clojure.spec.alpha :as spec])
(:import (java.util UUID)))
(spec/def ::date-str
#(re-matches #"\d{4}\d{2}\d{2}T\d{2}\d{2}\d{2}\.\d{3}Z" %))
(def conn
(delay (db/connect
"bolt://localhost:7687"

@ -33,15 +33,15 @@
[:h1.app-title "wan ijo"
(when authed?
[:small.app-title__hello
"O, "
"Hi, "
[:a {:href (path :user-profile)} ident]])]
(when authed?
[:section.header-content
(btnlink (path :schema-overview)
"Jaki ijo"
"Schemas"
"header-content__link")
(btnlink (path :auth-logout)
"Lape!"
"Logout!"
"header-content__link")])]
[:nav (when authed? "nav")]
(vec (concat [:main] content))
@ -51,5 +51,5 @@
(defn flash-error [content]
[:section.flash--error
[:h2.flash__heading--error "Pakala"]
[:h2.flash__heading--error "Warning"]
content])

@ -6,8 +6,7 @@
(spec/and string? not-empty))
(spec/def ::created-at
(spec/and string?
#(re-matches #"\d{4}\d{2}\d{2}T\d{2}\d{2}\d{2}\.\d{3}Z" %)))
(spec/and string? ::neo4j/date-str))
(neo4j/defquery
all-created-by

@ -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!"))]))

@ -21,7 +21,7 @@
(view/layout!
:session (:session req)
:content
[[:h1 "O, " (get-in req [:session :ident])]
[[:h1 "Hi, " (get-in req [:session :ident])]
[:div (str user)]
(hform/form-to [:post (path :user-edit)]
(anti-forgery-field)

Loading…
Cancel
Save