Module: CMS::LocaleHelper

Defined in:
app/helpers/cms/locale_helper.rb

Instance Method Summary collapse

Instance Method Details

#cms_locale_selectorObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/cms/locale_helper.rb', line 3

def cms_locale_selector
  if RailsAdminCMS::Config.hide_current_locale?
    links = []
  else
    links = [ link_to(t('cms.locale_selector.language'), '#', class: 'active') ]
  end

  I18n.available_locales.reject{ |l| l == locale }.each do |locale|
    path = current_url_for(locale)
    links << link_to(t('cms.locale_selector.language', locale: locale), path)
  end

  (:ul, class: 'cms-locale-selector') do
    links.each do |link|
      concat (:li, link)
    end
  end
end