Start using translation strings in some parts of dashboard.

This commit is contained in:
Andrey Antukh 2016-01-08 01:44:27 +02:00
parent 0f41481580
commit 0139a8ab58
3 changed files with 21 additions and 24 deletions

View file

@ -3,6 +3,7 @@
[rum.core :as rum] [rum.core :as rum]
[cuerdas.core :as str] [cuerdas.core :as str]
[cats.labs.lens :as l] [cats.labs.lens :as l]
[uxbox.locales :as t :refer (tr)]
[uxbox.state :as st] [uxbox.state :as st]
[uxbox.rstore :as rs] [uxbox.rstore :as rs]
[uxbox.schema :as sc] [uxbox.schema :as sc]
@ -49,13 +50,11 @@
own? (:builtin coll false)] own? (:builtin coll false)]
(html (html
[:div.dashboard-title {} [:div.dashboard-title {}
(if coll
[:h2 {} [:h2 {}
[:span "Library: "] [:span #ux/tr "ds.library-title"]
[:span {:content-editable "" [:span {:content-editable ""
:on-key-up on-title-edited} :on-key-up on-title-edited}
(:name coll)]] (:name coll)]]
[:h2 "No library selected"])
(if (and (not own?) coll) (if (and (not own?) coll)
[:div.edition {} [:div.edition {}
#_[:span i/pencil] #_[:span i/pencil]
@ -97,13 +96,14 @@
[:a.btn-primary [:a.btn-primary
{:on-click #(rs/emit! (dd/mk-color-collection))} {:on-click #(rs/emit! (dd/mk-color-collection))}
"+ New library"]]) "+ New library"]])
(for [props collections] (for [props collections
:let [num (count (:colors props))]]
[: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)))
:class-name (when (= (:id props) collid) "current")} :class-name (when (= (:id props) collid) "current")}
[:span.element-title (:name props)] [:span.element-title (:name props)]
[:span.element-subtitle [:span.element-subtitle
(str (count (:colors props)) " elements")]])]]]))) (tr "ds.num-elements" (t/c num))]])]]])))
(def ^:static nav (def ^:static nav
(util/component (util/component

View file

@ -2,6 +2,7 @@
(:require [sablono.core :as html :refer-macros [html]] (:require [sablono.core :as html :refer-macros [html]]
[rum.core :as rum] [rum.core :as rum]
[cats.labs.lens :as l] [cats.labs.lens :as l]
[uxbox.locales]
[uxbox.router :as r] [uxbox.router :as r]
[uxbox.rstore :as rs] [uxbox.rstore :as rs]
[uxbox.state :as s] [uxbox.state :as s]
@ -34,13 +35,13 @@
(header-link :dashboard/projects i/logo)] (header-link :dashboard/projects i/logo)]
[:ul.main-nav [:ul.main-nav
[:li {:class (when projects? "current")} [:li {:class (when projects? "current")}
(header-link :dashboard/projects "PROJECTS")] (header-link :dashboard/projects #ux/tr "ds.projects")]
[:li {:class (when elements? "current")} [:li {:class (when elements? "current")}
(header-link :dashboard/elements "ELEMENTS")] (header-link :dashboard/elements #ux/tr "ds.elements")]
[:li {:class (when icons? "current")} [:li {:class (when icons? "current")}
(header-link :dashboard/icons "ICONS")] (header-link :dashboard/icons #ux/tr "ds.icons")]
[:li {:class (when colors? "current")} [:li {:class (when colors? "current")}
(header-link :dashboard/colors "COLORS")]] (header-link :dashboard/colors #ux/tr "ds.colors")]]
(ui.u/user)]))) (ui.u/user)])))
(def ^:static header (def ^:static header

View file

@ -35,13 +35,11 @@
own? (:builtin coll false)] own? (:builtin coll false)]
(html (html
[:div.dashboard-title {} [:div.dashboard-title {}
(if coll
[:h2 {} [:h2 {}
[:span "Library: "] [:span #ux/tr "ds.library-title"]
[:span {:content-editable "" [:span {:content-editable ""
:on-key-up (constantly nil)} :on-key-up (constantly nil)}
(:name coll)]] (:name coll)]]
[:h2 "No library selected"])
(if (and (not own?) coll) (if (and (not own?) coll)
[:div.edition {} [:div.edition {}
[:span {:on-click (constantly nil)} [:span {:on-click (constantly nil)}
@ -53,7 +51,6 @@
:name "page-title" :name "page-title"
:mixins [mx/static rum/reactive]})) :mixins [mx/static rum/reactive]}))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Nav ;; Nav
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -61,7 +58,6 @@
(defn nav-render (defn nav-render
[own] [own]
(let [dashboard (rum/react dashboard-state) (let [dashboard (rum/react dashboard-state)
;; colors (rum/react collections-state)
collid (:collection-id dashboard) collid (:collection-id dashboard)
own? (= (:collection-type dashboard) :own) own? (= (:collection-type dashboard) :own)
builtin? (= (:collection-type dashboard) :builtin) builtin? (= (:collection-type dashboard) :builtin)
@ -74,10 +70,10 @@
[:ul.library-tabs [:ul.library-tabs
[:li {:class-name (when builtin? "current") [:li {:class-name (when builtin? "current")
:on-click #(rs/emit! (dd/set-collection-type :builtin))} :on-click #(rs/emit! (dd/set-collection-type :builtin))}
"STANDARD"] #ux/tr "ds.standard-title"]
[:li {:class-name (when own? "current") [:li {:class-name (when own? "current")
:on-click #(rs/emit! (dd/set-collection-type :own))} :on-click #(rs/emit! (dd/set-collection-type :own))}
"YOUR LIBRARIES"]] #ux/tr "ds.your-libraries-title"]]
[:ul.library-elements [:ul.library-elements
(when own? (when own?
[:li [:li