Use configured available locales

This commit is contained in:
2015-01-13 16:56:06 +01:00
parent 525d942d3d
commit 978832bf25
4 changed files with 15 additions and 9 deletions
+9 -2
View File
@@ -21,10 +21,17 @@ are:
To start using Cmtool as website CMS add it to your Gemfile. Since it depends
on github gems and gem dependencies do not support those you have to
explicitly add two dependencies to your Gemfile:
gem 'couch_potato' , :git => 'git://github.com/bterkuile/couch_potato.git'
gem 'simply_stored' , :git => 'git://github.com/bterkuile/simply_stored.git'
gem 'couch_potato' , github: 'bterkuile/couch_potato'
gem 'simply_stored' , github: 'bterkuile/simply_stored'
gem 'cmtool'
Make sure that the locales you want to work with are specified in
```config/application.rb```.
```ruby
config.i18n.default_locale = :en
config.i18n.available_locales = [:en, :nl]
```
This will add some gems you might like anyway, here a list:
* bourbon
@@ -2,8 +2,8 @@
tr
td= link_to ' - '*page.tree_depth + page.name, cmtool.edit_page_path(page)
td= page.title
td.locale class: "locale-#{page.locale}" = page.locale
td= boolean_text controller.template_exists?("pages/# page.name ")
td.locale class="locale-#{page.locale}" = page.locale
td= boolean_text controller.template_exists?("pages/#{page.name}")
td= boolean_text page.in_menu?
th= page.tree_path.map(&:position).map(&:to_s).join('.')
- if children = page.children.presence
+2 -4
View File
@@ -11,10 +11,8 @@ table.index-table.table.table-striped.table-hover
th
th
tbody
= render 'nested_pages', pages: Page.full_tree(:nl)
= render 'nested_pages', pages: Page.full_tree(:en)
= render 'nested_pages', pages: Page.full_tree(:de)
= render 'nested_pages', pages: Page.full_tree(:es)
- Rails.configuration.available_locales.each do |locale|
= render 'nested_pages', pages: Page.full_tree(locale)
- content_for :page_links do
ul
+2 -1
View File
@@ -61,7 +61,8 @@ module Cmtool
[:ad, :ae, :af, :ag, :ai, :al, :am, :an, :ao, :aq, :ar, :as, :at, :au, :aw, :az, :ba, :bb, :bd, :be, :bf, :bg, :bh, :bi, :bj, :bm, :bn, :bo, :br, :bs, :bt, :bw, :by, :bz, :ca, :cd, :cf, :cg, :ch, :ci, :ck, :cl, :cm, :cn, :co, :cr, :cu, :cv, :cy, :cz, :de, :dj, :dk, :dm, :do, :dz, :ec, :ee, :eg, :eh, :en, :er, :es, :et, :fi, :fj, :fm, :fo, :fr, :ga, :gb, :gd, :ge, :gg, :gh, :gi, :gl, :gm, :gn, :gp, :gq, :gr, :gt, :gu, :gw, :gy, :hk, :hn, :hr, :ht, :hu, :id, :ie, :il, :im, :in, :iq, :ir, :is, :it, :je, :jm, :jo, :jp, :ke, :kg, :kh, :ki, :km, :kn, :kp, :kr, :kw, :ky, :kz, :la, :lb, :lc, :li, :lk, :lr, :ls, :lt, :lu, :lv, :ly, :ma, :mc, :md, :me, :mg, :mh, :mk, :ml, :mm, :mn, :mo, :mq, :mr, :ms, :mt, :mu, :mv, :mw, :mx, :my, :mz, :na, :nc, :ne, :ng, :ni, :nl, :no, :np, :nr, :nz, :om, :pa, :pe, :pf, :pg, :ph, :pk, :pl, :pr, :ps, :pt, :pw, :py, :qa, :re, :ro, :rs, :ru, :rw, :sa, :sb, :sc, :sd, :se, :sg, :si, :sk, :sl, :sm, :sn, :so, :sr, :st, :sv, :sy, :sz, :tc, :td, :tg, :th, :tj, :tl, :tm, :tn, :to, :tr, :tt, :tv, :tw, :tz, :ua, :ug, :us, :uy, :uz, :va, :vc, :ve, :vg, :vi, :vn, :vu, :ws, :ye, :za, :zm, :zw]
end
def locales
[:en, :nl, :de, :es]
#[:en, :nl, :de, :es]
Rails.configuration.i18n.available_locales.presence || []
end
def default_locale
:en