From 8e70dcd71a64b9c2a9afaeaaa38f2dbaf14ed828 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Fri, 14 Feb 2020 15:08:08 +0100 Subject: [PATCH] nicer breadcrumbs --- resources/public/css/public.css | 5 +++++ resources/public/img/klammer.svg | 12 ++++++++++++ src/wanijo/public/routes.clj | 2 +- src/wanijo/public/view.clj | 32 ++++++++++++++++++-------------- 4 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 resources/public/img/klammer.svg diff --git a/resources/public/css/public.css b/resources/public/css/public.css index 2c5c6bf..38efecb 100644 --- a/resources/public/css/public.css +++ b/resources/public/css/public.css @@ -104,6 +104,11 @@ body { font-family: 'jetbrains-mono'; } +.breadcrumb img { + height: 1.4rem; + margin: 0 .6rem; +} + .breadcrumb-item + .breadcrumb-item::before { content: "//"; } diff --git a/resources/public/img/klammer.svg b/resources/public/img/klammer.svg new file mode 100644 index 0000000..24f5cdd --- /dev/null +++ b/resources/public/img/klammer.svg @@ -0,0 +1,12 @@ + + +image/svg+xml + + + + + diff --git a/src/wanijo/public/routes.clj b/src/wanijo/public/routes.clj index be421be..35db308 100644 --- a/src/wanijo/public/routes.clj +++ b/src/wanijo/public/routes.clj @@ -19,7 +19,7 @@ (defroutes routes (GET (register! :public-index "/public") [] (index)) - (GET (register! :public-coc-roles "/public/:coc") [coc] (show-coc coc)) + (GET (register! :public-coc "/public/:coc") [coc] (show-coc coc)) (GET (register! :public-role-modules "/public/:coc/:level") [coc level] (show-modules coc level))) diff --git a/src/wanijo/public/view.clj b/src/wanijo/public/view.clj index c900c6f..2521188 100644 --- a/src/wanijo/public/view.clj +++ b/src/wanijo/public/view.clj @@ -3,6 +3,16 @@ [hiccup.core :refer [h]] [wanijo.infrastructure.routing :refer [path]])) +(defn breadcrumb [& links] + [:nav + [:ol.breadcrumb + (into + [:li.breadcrumb-item + [:a {:href (path :public-index)} + [:img {:src "/img/klammer.svg"}] + "Start"]] + links)]]) + (defn layout [title content] (html5 [:head @@ -30,13 +40,13 @@ [:menu.global-nav [:ol.global-nav__card-nav [:li.global-nav__card-nav-item - [:a.global-nav__link {:href (path :public-coc-roles {:coc "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-roles {:coc "prk"})} + [: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-roles {:coc "req"})} + [:a.global-nav__link {:href (path :public-coc {:coc "req"})} "Req. Eng."]]]] (into [:div.content] content)]])) @@ -82,11 +92,8 @@ {:coc (:key coc) :level (:uuid level)})} (h (:name level))]]])))]]]] - [:nav - [:ol.breadcrumb - [:li.breadcrumb-item - [:a {:href (path :public-index)} "Start"]] - [:li.breadcrumb-item.active (h (:name coc))]]]])) + (breadcrumb + [:li.breadcrumb-item.active (h (:name coc))])])) (defn show-modules [coc level modules-with-comps] (layout @@ -111,12 +118,9 @@ (for [compo (rest comps)] [:tr [:td (h (:name compo))]])))]]]] - [:nav - [:ol.breadcrumb - [:li.breadcrumb-item - [:a {:href (path :public-index)} "Start"]] + (breadcrumb [:li.breadcrumb-item - [:a {:href (path :public-coc-roles + [:a {:href (path :public-coc {:coc (:key coc)})} (h (:name coc))]] - [:li.breadcrumb-item.active (h (:name level))]]]])) + [:li.breadcrumb-item.active (h (:name level))])]))