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]}) 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"]]]]))] 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))]]