|
28 | 28 | om/IRenderState
|
29 | 29 | (render-state [_ {:keys [channel on-selection active-path]}]
|
30 | 30 | (html
|
31 |
| - [:li {:class [(when (= (get-in cursor [active-path]) |
32 |
| - (:id entry)) |
33 |
| - "active")]} |
34 | 31 |
|
35 | 32 | (if (:items entry)
|
36 | 33 | (dropdown cursor (->> {:id (:id entry)
|
37 | 34 | :type :menu
|
38 | 35 | :icon (:icon entry)
|
39 | 36 | :title (:text entry)
|
| 37 | + :className (if (= (get-in cursor [active-path]) |
| 38 | + (:id entry)) |
| 39 | + "active" |
| 40 | + "") |
40 | 41 | :on-selection (fn [v]
|
41 | 42 | (on-selection v)
|
42 | 43 | (when (om/get-state owner :collapsed?)
|
43 | 44 | (put! channel :toggle-menu)))
|
44 | 45 | :items (:items entry)}
|
45 | 46 | (th/when->> (:className entry)
|
46 | 47 | (merge {:className (:className entry)}))))
|
47 |
| - [:a (->> {} |
48 |
| - (th/when->> (:className entry) |
49 |
| - (merge {:className (:className entry)})) |
50 |
| - (th/when->> (:url entry) |
51 |
| - (merge {:href (:url entry)})) |
52 |
| - (th/when->> on-selection |
53 |
| - (merge {:onClick (fn [e] |
54 |
| - (on-selection (:id @entry)) |
55 |
| - (when (om/get-state owner :collapsed?) |
56 |
| - (put! channel :toggle-menu)))}))) |
57 |
| - |
58 |
| - (when (or (:iconClassName entry) (:icon entry)) |
59 |
| - [:span {:class (or (:iconClassName entry) |
60 |
| - (u/glyph (:icon entry)))}]) |
61 |
| - |
62 |
| - (if (fn? (:text entry)) |
63 |
| - ((:text entry)) |
64 |
| - [:span (:text entry)]) |
65 |
| - |
66 |
| - (when (:badge entry) |
67 |
| - [:span.badge (:badge entry)])])])))) |
| 48 | + |
| 49 | + |
| 50 | + [:li {:class [(when (= (get-in cursor [active-path]) |
| 51 | + (:id entry)) |
| 52 | + "active")]} |
| 53 | + [:a (->> {} |
| 54 | + (th/when->> (:className entry) |
| 55 | + (merge {:className (:className entry)})) |
| 56 | + (th/when->> (:url entry) |
| 57 | + (merge {:href (:url entry)})) |
| 58 | + (th/when->> on-selection |
| 59 | + (merge {:onClick (fn [e] |
| 60 | + (on-selection (:id @entry)) |
| 61 | + (when (om/get-state owner :collapsed?) |
| 62 | + (put! channel :toggle-menu)))}))) |
| 63 | + |
| 64 | + (when (or (:iconClassName entry) (:icon entry)) |
| 65 | + [:span {:class (or (:iconClassName entry) |
| 66 | + (u/glyph (:icon entry)))}]) |
| 67 | + |
| 68 | + (if (fn? (:text entry)) |
| 69 | + ((:text entry)) |
| 70 | + [:span (:text entry)]) |
| 71 | + |
| 72 | + (when (:badge entry) |
| 73 | + [:span.badge (:badge entry)])]]))))) |
| 74 | + |
68 | 75 |
|
69 | 76 | (defn- navbar-nav
|
70 | 77 | [{:keys [cursor entries]} owner]
|
|
0 commit comments