diff --git a/project.clj b/project.clj index ab72da0..aaaf167 100644 --- a/project.clj +++ b/project.clj @@ -17,4 +17,5 @@ [ring/ring-mock "0.3.0"]] :plugins [[lein-less "1.7.5"]]}} :less {:source-paths ["resources/app/stylesheets"] - :target-path "resources/public/css"}) + :target-path "resources/public/css"} + :hiera {:cluster-depth 2}) diff --git a/src/wanijo/auth/routes.clj b/src/wanijo/auth/routes.clj index 7656b5c..3d97f64 100644 --- a/src/wanijo/auth/routes.clj +++ b/src/wanijo/auth/routes.clj @@ -5,11 +5,11 @@ [buddy.hashers :as hashers] [hiccup.form :as hform] [wanijo.view :as view] - [wanijo.neo4j :as neo4j])) + [wanijo.domain.user :as domain-user])) (defn- login-check! [req] (let [{{:keys [uname pw]} :params} req - unode (neo4j/find-user! uname) + unode (domain-user/find! uname) pwmatch (when-let [hash (:pw unode)] (hashers/check pw hash))] (if pwmatch diff --git a/src/wanijo/domain/user.clj b/src/wanijo/domain/user.clj new file mode 100644 index 0000000..f4fb27a --- /dev/null +++ b/src/wanijo/domain/user.clj @@ -0,0 +1,11 @@ +(ns wanijo.domain.user + (:require [wanijo.neo4j :as neo4j])) + +(defn find! [ident] + (neo4j/query-rawdata! + :query + "MATCH (n:user) + WHERE n.ident = {ident} + RETURN n" + :alias "n" + :params {:ident ident})) diff --git a/src/wanijo/home/view.clj b/src/wanijo/home/view.clj index d3d0bab..3741e36 100644 --- a/src/wanijo/home/view.clj +++ b/src/wanijo/home/view.clj @@ -1,5 +1,5 @@ (ns wanijo.home.view - (:require [wanijo.view :as view])) + (:require [wanijo.view.page :as page])) (defn root! [req] - (view/layout! :session (:session req))) + (page/layout! :session (:session req))) diff --git a/src/wanijo/neo4j.clj b/src/wanijo/neo4j.clj index 55b43b6..5d20fb8 100644 --- a/src/wanijo/neo4j.clj +++ b/src/wanijo/neo4j.clj @@ -28,12 +28,3 @@ (cypher/tquery (conn!) query params) (map #(get % alias)) (map :data))) - -(defn find-user! [ident] - (query-rawdata! - :query - "MATCH (n:user) - WHERE n.ident = {ident} - RETURN n" - :alias "n" - :params {:ident ident})) diff --git a/src/wanijo/schema/routes.clj b/src/wanijo/schema/routes.clj index bf2c144..ff96eec 100644 --- a/src/wanijo/schema/routes.clj +++ b/src/wanijo/schema/routes.clj @@ -3,9 +3,9 @@ [ring.util.anti-forgery :refer [anti-forgery-field]] [ring.util.response :as resp] [hiccup.form :as hform] - [wanijo.domain.schema :as domain-schemas] - [wanijo.view :as view] - [wanijo.forms :as forms])) + [wanijo.domain.schema :as domain-schema] + [wanijo.view.page :as page] + [wanijo.view.forms :as forms])) (def new-schema-form {:fields {:schema-name {:label "Nimi" @@ -15,8 +15,8 @@ (defn- overview! [req] (let [session (:session req) ident (:ident session) - schemas (domain-schemas/all-created-by! ident)] - (view/layout! + schemas (domain-schema/all-created-by! ident)] + (page/layout! :session session :content [[:h1 "Ali jaki ijo"] diff --git a/src/wanijo/forms.clj b/src/wanijo/view/forms.clj similarity index 93% rename from src/wanijo/forms.clj rename to src/wanijo/view/forms.clj index fd49d13..4040614 100644 --- a/src/wanijo/forms.clj +++ b/src/wanijo/view/forms.clj @@ -1,10 +1,10 @@ -(ns wanijo.forms +(ns wanijo.view.forms (:require [hiccup.form :as hform] [clojure.spec.alpha :as spec] - [wanijo.view :as view])) + [wanijo.view.page :as page])) (defn spec-to-errmsg [label spec-key field-value] - (view/flash-error + (page/flash-error (map (fn [prob] [:p diff --git a/src/wanijo/view.clj b/src/wanijo/view/page.clj similarity index 92% rename from src/wanijo/view.clj rename to src/wanijo/view/page.clj index f6edb74..d0025f2 100644 --- a/src/wanijo/view.clj +++ b/src/wanijo/view/page.clj @@ -1,6 +1,6 @@ -(ns wanijo.view - (:require [hiccup.page :refer [html5 - include-css]])) +(ns wanijo.view.page + (:require [hiccup.page :refer + [html5 include-css]])) (defn btnlink ([target caption]