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 :3fe705
:30ffab :30ffab
:352105 :352105
:209f20
:207820
:205e20
:290020
:350220
:3fe720
:30ff20
:352120
:352140
}}]) }}])
(def ^:static +color-collections-by-id+ (def ^:static +color-collections-by-id+

View file

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