From 810f2ab6571be88da98e32bf2e502e2c25aecfb2 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Wed, 11 Mar 2020 21:35:56 +0100 Subject: [PATCH] descriptions for roles in public module --- hastur-env.sh | 3 +++ resources/public/css/public.css | 14 +++++++------- src/wanijo/public/db.clj | 16 +++++++++++++++- src/wanijo/public/routes.clj | 2 +- src/wanijo/public/view.clj | 4 +++- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/hastur-env.sh b/hastur-env.sh index d7487c1..2b8ea77 100644 --- a/hastur-env.sh +++ b/hastur-env.sh @@ -4,6 +4,9 @@ export SCHEMA_LEVEL=67bc62b7-77da-4a4e-9cdd-eeaa3061d0ee export SCHEMA_MODULE=fbf30747-2fd3-4479-8e5b-e03b4509554b export SCHEMA_COMPONENT=f229b8c7-3794-4ded-8192-052dd7af3830 +export ATTR_MODULE_DESC=0924be5a-9680-44e3-986f-54b5b59631ba +export ATTR_ROLE_DESC=39e467a5-9ed2-496b-bc98-a14e3b52a8d1 + export INST_DEV=73f69c1b-5106-44bb-b5e1-90c4f3847037 export INST_REQ=1d155970-f211-4699-9b90-21ef748c6afd export INST_PRK=46dfa4e3-4223-4e76-9fb1-2fbdcec15f74 diff --git a/resources/public/css/public.css b/resources/public/css/public.css index fab672b..dc138ea 100644 --- a/resources/public/css/public.css +++ b/resources/public/css/public.css @@ -186,17 +186,17 @@ table [data-sort="asc"]::after { display: inline; } -.module-desc { +.markdown-content { margin-top: 3rem; padding-left: 1rem; } -.module-desc h1 { +.markdown-content h1 { font-size: 2rem; margin-left: -1rem; } -.module-desc h1::before { +.markdown-content h1::before { display: inline-block; content: " "; background-image: url('../img/klammer.svg'); @@ -208,19 +208,19 @@ table [data-sort="asc"]::after { margin-right: .5rem; } -.module-desc h2 { +.markdown-content h2 { font-size: 1.7rem; } -.module-desc h3 { +.markdown-content h3 { font-size: 1.5rem; } -.module-desc h4 { +.markdown-content h4 { font-size: 1.3rem; } -.module-desc blockquote { +.markdown-content blockquote { padding: 1rem .5rem 0 1rem; background-color: rgba(230, 230, 230, .5); border: 1px solid transparent; diff --git a/src/wanijo/public/db.clj b/src/wanijo/public/db.clj index 7f4ef53..cf423c1 100644 --- a/src/wanijo/public/db.clj +++ b/src/wanijo/public/db.clj @@ -15,7 +15,9 @@ (def attribute-uuids {:module-desc (or (System/getenv "ATTR_MODULE_DESC") - "0924be5a-9680-44e3-986f-54b5b59631ba")}) + "0924be5a-9680-44e3-986f-54b5b59631ba") + :role-desc (or (System/getenv "ATTR_ROLE_DESC") + "39e467a5-9ed2-496b-bc98-a14e3b52a8d1")}) (def coc-instance-uuids {"dev" (or (System/getenv "INST_DEV") @@ -172,3 +174,15 @@ :components comps))) (comment (module! "0b30521a-0727-4a6b-b69e-6f3c554a81b2")) + +(defn role! [uuid] + (let [i (instance! uuid) + desc (->> (:properties i) + (filter #(= (:role-desc attribute-uuids) + (-> % :attr :uuid))) + first + :value)] + (assoc i + :desc desc))) +(comment + (role! "2c507f67-600d-4add-b648-2ea62d5a4ffc")) diff --git a/src/wanijo/public/routes.clj b/src/wanijo/public/routes.clj index 37c0403..541da55 100644 --- a/src/wanijo/public/routes.clj +++ b/src/wanijo/public/routes.clj @@ -20,7 +20,7 @@ (defn show-role [coc-key role-uuid] (view-public/show-role (db-public/coc! coc-key) - (db-public/instance! role-uuid) + (db-public/role! role-uuid) (db-public/modules-and-levels! role-uuid))) (defn show-module [coc-key module-uuid] diff --git a/src/wanijo/public/view.clj b/src/wanijo/public/view.clj index b8e39ed..9f26456 100644 --- a/src/wanijo/public/view.clj +++ b/src/wanijo/public/view.clj @@ -138,6 +138,8 @@ (h (:name role)) [[:main.main [:h1 "Rolle " (h (:name role))] + [:div.markdown-content + (md/md-to-html-string (:desc role))] [:div.table-responsive [:table.table [:thead @@ -168,7 +170,7 @@ (h (:name module)) [[:main.main [:h1 "Modul " (h (:name module))] - [:div.module-desc + [:div.markdown-content (md/md-to-html-string (:desc module))] [:h2 "Komponenten"] [:table.table