From d0b2415befce1120866a5973cf568c044015620a Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Sun, 21 Apr 2019 12:10:53 +0200 Subject: [PATCH 1/3] add less to lein compile --- project.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/project.clj b/project.clj index e3f0b03..fd3282e 100644 --- a/project.clj +++ b/project.clj @@ -61,6 +61,7 @@ :ring {:handler wanijo.handler/app} :less {:source-paths ["resources/app/stylesheets"] :target-path "resources/public/css"} - :aliases {"uberjar" ["do" ["less" "once"] "uberjar"]} + :aliases {"uberjar" ["do" ["less" "once"] "uberjar"] + "compile" ["do" ["less" "once"] "compile"]} :hiera {:cluster-depth 2} :eastwood {:namespaces [:source-paths]}) From 35efb74fa892c25610ab51c9806f4ce4c5fc64f5 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Sun, 21 Apr 2019 12:23:18 +0200 Subject: [PATCH 2/3] some styling, hopefully for the better --- resources/app/stylesheets/app.less | 10 ++++++++++ src/wanijo/framework/view.clj | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/app/stylesheets/app.less b/resources/app/stylesheets/app.less index f755991..9b2240d 100644 --- a/resources/app/stylesheets/app.less +++ b/resources/app/stylesheets/app.less @@ -108,10 +108,20 @@ img, svg { grid-area: nav; .accent-border-element; + h2::before { + content: "▤ "; + color: @ci-blue; + } + h2 { margin-left: -1rem; padding-left: 1rem; } + + ul { + list-style-type: none; + padding-left: 1.8rem; + } } main { diff --git a/src/wanijo/framework/view.clj b/src/wanijo/framework/view.clj index 522ad00..b3b28e5 100644 --- a/src/wanijo/framework/view.clj +++ b/src/wanijo/framework/view.clj @@ -70,14 +70,14 @@ (when authed? (list [:section.schemas - [:h2 [:span.__icon "▤"] "Schemas"] + [:h2 "Schemas"] [:ul (for [schema (:schemas session)] [:li [:a {:href (path :instance-list {:schema-uuid (:uuid schema)})} (h (:name schema))]])]] [:section - [:h2 [:span.__icon "▤"] "Visualisation"] + [:h2 "Visualisation"] [:ul [:li [:a {:href (path :vis-all-instances)} "All Instances"]]]]))] From 2e3f2d317882fab613453df8d6bb4d40d8b54d96 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Sun, 21 Apr 2019 22:20:46 +0200 Subject: [PATCH 3/3] starred querying --- src/wanijo/instance/domain.clj | 12 ++++++++++++ src/wanijo/instance/routes.clj | 7 ++++++- src/wanijo/instance/view.clj | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/wanijo/instance/domain.clj b/src/wanijo/instance/domain.clj index 8a466cd..96d638a 100644 --- a/src/wanijo/instance/domain.clj +++ b/src/wanijo/instance/domain.clj @@ -198,3 +198,15 @@ (outgoing-links! uuid) :links-in (incoming-links! uuid))) + +(neo4j/defquery is-starred + "MATCH (u:user {uuid:{user_uuid}}), + (i:instance {uuid:{uuid}}) + RETURN EXISTS((i)-[:starred_by]->(u)) AS starred") + +(defn is-starred! [uuid user-uuid] + (-> (neo4j/exec-query! is-starred + {:user_uuid user-uuid + :uuid uuid}) + first + :starred)) diff --git a/src/wanijo/instance/routes.clj b/src/wanijo/instance/routes.clj index b256533..026ecd4 100644 --- a/src/wanijo/instance/routes.clj +++ b/src/wanijo/instance/routes.clj @@ -40,7 +40,12 @@ (domain/full-instance-by-uuid! uuid)) (defn show! [uuid req] - (view/show! (instance! uuid) req)) + (let [user-uuid (-> req :session :uuid) + instance (assoc (instance! uuid) + :starred + (domain/is-starred! uuid + user-uuid))] + (view/show! instance req))) (defn form! [uuid attrs] (forms-inst/with-attributes attrs)) diff --git a/src/wanijo/instance/view.clj b/src/wanijo/instance/view.clj index 0433d81..c4a11ef 100644 --- a/src/wanijo/instance/view.clj +++ b/src/wanijo/instance/view.clj @@ -44,6 +44,9 @@ :request req :content [[:h1 + (if (:starred instance) + "★" "☆") + " " (h (-> instance :schema :name)) " " [:small (h (:name instance))]]