add joshavg/formulare, some cleanup on forms

integration-tests
Josha von Gizycki 6 years ago
parent c26d113462
commit 7ceb88e0c2

@ -8,6 +8,7 @@
[compojure "1.6.1"]
[ring/ring-defaults "0.3.2"]
[hiccup "1.0.5"]
[joshavg/formulare "0.2.1-SNAPSHOT"]
[gorillalabs/neo4j-clj "1.1.0"
:exclusions [org.bouncycastle/bcprov-jdk15on

@ -1,8 +1,8 @@
(ns wanijo.schema.routes
(:require [compojure.core :refer [defroutes GET POST DELETE]]
[ring.util.response :as resp]
[formulare.core :as form]
[wanijo.framework.view :as view]
[wanijo.framework.form :as form]
[wanijo.framework.routing :refer [register! path]]
[wanijo.schema.domain :as domain]
[wanijo.user.domain :as domain-user]

@ -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)

Loading…
Cancel
Save