Render properly the builtin collections.

This commit is contained in:
Andrey Antukh 2015-12-22 20:03:06 +02:00
parent 31bcce2668
commit 3748d3c7b4
2 changed files with 46 additions and 26 deletions

View file

@ -24,6 +24,16 @@
:3fe705
:30ffab
:352105
:209f20
:207820
:205e20
:290020
:350220
:3fe720
:30ff20
:352120
:352140
}}])
(def ^:static +color-collections-by-id+

View file

@ -57,18 +57,26 @@
(defn page-title-render
[]
(let [dashboard (rum/react dashboard-state)
own? (= (:collection-type dashboard) :own)
coll (get-collection {}
(:collection-type dashboard)
(:collection-id dashboard))]
(html
[:div.dashboard-title
[:h2 "Colors library name"]
(if coll
[:h2 (str "Library: " (:name coll))]
[:h2 "No library selected"])
(when (and own? coll)
[:div.edition
[:span i/pencil]
[:span i/trash]]]))
[:span i/trash]])])))
(def ^:static page-title
(util/component
{:render page-title-render
:name "page-title"
:mixins [mx/static]}))
:mixins [mx/static rum/reactive]}))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Nav
@ -95,9 +103,9 @@
:on-click #(rs/emit! (dd/set-collection-type :own))}
"YOUR LIBRARIES"]]
[:ul.library-elements
;; (when own?
;; [:li
;; [:a.btn-primary {:href "#"} "+ New library"]])
(when own?
[:li
[:a.btn-primary {:href "#"} "+ New library"]])
(for [props collections]
[:li {:key (str (:id props))
:on-click #(rs/emit! (dd/set-collection (:id props)))
@ -123,6 +131,7 @@
coll (get-collection {}
(:collection-type dashboard)
(:collection-id dashboard))]
(when coll
(html
[:div.dashboard-grid-content
(when own?
@ -137,9 +146,10 @@
[:span.color-swatch {:style {:background-color color-hex}}]
[:span.color-data (str "#" color-str)]
[:span.color-data (apply str "RGB " (interpose ", " color-rgb))]
(when own?
[:div.project-th-actions
[:div.project-th-icon.edit i/pencil]
[:div.project-th-icon.delete i/trash]]])])))
[:div.project-th-icon.delete i/trash]])])]))))
(def grid
(util/component