From 627dc678a9ee95de9ad39c960d6f182a65c40df5 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Sat, 1 Feb 2020 13:15:43 +0100 Subject: [PATCH] things bla --- src/wanijo/infrastructure/repl.clj | 7 ++++++- src/wanijo/main.clj | 3 ++- src/wanijo/public/db.clj | 10 ++++++++++ src/wanijo/public/routes.clj | 6 +++++- src/wanijo/public/view.clj | 19 +++++++++++++++---- 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 src/wanijo/public/db.clj diff --git a/src/wanijo/infrastructure/repl.clj b/src/wanijo/infrastructure/repl.clj index ac4634c..fccd4ec 100644 --- a/src/wanijo/infrastructure/repl.clj +++ b/src/wanijo/infrastructure/repl.clj @@ -1,7 +1,8 @@ (ns wanijo.infrastructure.repl (:require [buddy.hashers :as hashers] [neo4j-clj.core :as db] - [wanijo.infrastructure.neo4j :as neo4j])) + [wanijo.infrastructure.neo4j :as neo4j] + [wanijo.main :as main])) (db/defquery create-user "CREATE (n:user) @@ -93,3 +94,7 @@ (neo4j/exec-query! merge-config {:now (neo4j/now-str) :version (count migrations)}) nil) + +(defn dev-server! [] + (main/stop-server!) + (main/start-server-dev!)) diff --git a/src/wanijo/main.clj b/src/wanijo/main.clj index f283a2f..da45a30 100644 --- a/src/wanijo/main.clj +++ b/src/wanijo/main.clj @@ -20,7 +20,8 @@ :handler wanijo-handler/dev-app)) (defn stop-server! [] - (.stop @server)) + (when @server + (.stop @server))) (defn restart-server-dev! [] (stop-server!) diff --git a/src/wanijo/public/db.clj b/src/wanijo/public/db.clj new file mode 100644 index 0000000..3c0a5c8 --- /dev/null +++ b/src/wanijo/public/db.clj @@ -0,0 +1,10 @@ +(ns wanijo.public.db + (:require [wanijo.infrastructure.neo4j :as neo4j])) + +(def key-mapping + {"dev" "Development" + "req" "Projekte" + "prk" "Requirements Engineering"}) + +(neo4j/defquery roles + "MATCH (i:instance {name:{name}})") diff --git a/src/wanijo/public/routes.clj b/src/wanijo/public/routes.clj index d5ab54e..ba82b93 100644 --- a/src/wanijo/public/routes.clj +++ b/src/wanijo/public/routes.clj @@ -6,5 +6,9 @@ (defn index [] (view-public/index)) +(defn show-coc [coc] + (view-public/show-coc coc)) + (defroutes routes - (GET (register! :public-index "/public") [] (index))) + (GET (register! :public-index "/public") [] (index)) + (GET (register! :public-coc "/public/:coc") [coc] (show-coc coc))) diff --git a/src/wanijo/public/view.clj b/src/wanijo/public/view.clj index 14244f3..d98d95d 100644 --- a/src/wanijo/public/view.clj +++ b/src/wanijo/public/view.clj @@ -20,16 +20,23 @@ [:button.navbar-toggler {:type "button" :data-toggle "collapse" :data-target "#navbar-content"} - [:span.navbar-toǵgler-icon]] + [:span.navbar-toggler-icon]] [:div#navbar-content.collapse.navbar-collapse.text-right [:div#navbar-nav.ml-auto - "Dingens"]]] + [:a {:href (path :auth-login)} + "Login"]]]] [:div.container-fluid.super-container [:menu.global-nav [:ol.global-nav__card-nav [:li.global-nav__card-nav-item - [:a.global-nav__link {:href "#"} - "Dev"]]]] + [:a.global-nav__link {:href (path :public-coc {:coc "dev"})} + "Development"]] + [:li.global-nav__card-nav-item + [:a.global-nav__link {:href (path :public-coc {:coc "prk"})} + "Projekte"]] + [:li.global-nav__card-nav-item + [:a.global-nav__link {:href (path :public-coc {:coc "req"})} + "Req. Eng."]]]] (into [:main.main] content)]])) (defn index [] @@ -41,3 +48,7 @@ [:p "Du möchtest dich weiterentwickeln?" "Dann gestalte selbst deinen Weg bei der TRIO und sprich" "deinen Vorgesetzten an"]])) + +(defn show-coc [coc] + (layout + [[:h1 "CoC " coc]]))