Sha256: eab76774ac2a3bda17b90d53004862a7f0cd630da810a1e180c8f020de1b18e2

Contents?: true

Size: 951 Bytes

Versions: 22

Compression:

Stored size: 951 Bytes

Contents

module RsLocalizeable
  extend ActiveSupport::Concern
  included do
    before_filter do
      I18n.locale = params[:locale] || I18n.default_locale
      Settings.ns_default = "main_#{I18n.locale}"
      Settings.ns_fallback = "main"
    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
    if RocketCMS.mongoid?
      pages = pages.where(:"name.#{I18n.locale}".exists => true)
    elsif RocketCMS.active_record?
      pages = pages.where(["EXIST(name_translations, ?) = TRUE AND name_translations -> ? != ''", I18n.locale, I18n.locale])
    end
    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

22 entries across 22 versions & 2 rubygems

Version Path
rocket_cms-0.11.1 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.11.0 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.10.2 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.10.1 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.10.0 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.9.9 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.9.8 app/controllers/concerns/rs_localizeable.rb
ack_rocket_cms-0.9.2 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.9.7 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.9.5 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.9.4 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.9.3 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.9.2 app/controllers/concerns/rs_localizeable.rb
ack_rocket_cms-0.9.1.3 app/controllers/concerns/rs_localizeable.rb
ack_rocket_cms-0.9.1.2 app/controllers/concerns/rs_localizeable.rb
ack_rocket_cms-0.9.1.1 app/controllers/concerns/rs_localizeable.rb
ack_rocket_cms-0.9.1 app/controllers/concerns/rs_localizeable.rb
ack_rocket_cms-0.9 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.9.1 app/controllers/concerns/rs_localizeable.rb
rocket_cms-0.8.13 app/controllers/concerns/rs_localizeable.rb