Sha256: 521acc40189511f2a8f9801dc103add5fb2b1ae952513da2d9ab5809ce248d88

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

module RsLocalizeable
  extend ActiveSupport::Concern
  included do
    before_filter do
      I18n.locale = params[:locale] || I18n.default_locale
    end
  end
  private
  def default_url_options(options={})
    {locale: params[:locale]}
  end
  def nav_get_menu_items(type)
    pages = ::Menu.find(type.to_s).pages.enabled
    pages = pages.where(["EXIST(name_translations, ?) = TRUE AND name_translations -> ? != ''", I18n.locale, I18n.locale])
    pages.sorted.to_a
  end
  def nav_get_url(item)
    (params[:locale].blank? ? "" : "/#{params[:locale]}") + (item.redirect.blank? ? item.fullpath : item.redirect)
  end
  def find_seo_extra(path)
    Page.enabled.where(fullpath: path.gsub(/(\/ru|\/en)/, "")).first
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rocket_cms-0.8.5 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.8.4 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.8.3 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.8.1 app/controllers/concerns/rs_localizeable.rb