Sha256: b37383345664110fb1c467f598bb931f3c66a86a49997e5d5220639b0994d09d
Contents?: true
Size: 884 Bytes
Versions: 6
Compression:
Stored size: 884 Bytes
Contents
module CMS module LocaleHelper def cms_locale_selector links = [ link_to(t('cms.locale_selector.language'), '#', class: 'active') ] 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 content_tag(:ul) do links.each do |link| concat content_tag(:li, link) end end end private def current_url_for(locale) url = case controller_path when /^cms\/(pages|forms)/ if @cms_view @cms_view.other_uuid(locale).try(:url) else main_app.try("#{params[:cms_view_type]}_#{locale}_path") end else url_for(:locale => locale.to_s) end url.presence || main_app.root_path(locale: locale) end end end
Version data entries
6 entries across 6 versions & 1 rubygems