Class: Qbrick::Cms::BackendController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/qbrick/cms/backend_controller.rb

Instance Method Summary collapse

Instance Method Details

#default_url_optionsObject



20
21
22
# File 'app/controllers/qbrick/cms/backend_controller.rb', line 20

def default_url_options
  { content_locale: I18n.locale }.merge(super)
end

#set_content_localeObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/qbrick/cms/backend_controller.rb', line 8

def set_content_locale
  # this was taken from: https://github.com/screenconcept/hieronymus_shop/pull/218/files
  # and needs further work:
  # TODO: document how to implement in frontend
  # TODO: implement frontend part in our rails_template
  # TODO: add specs
  new_locale = params[:content_locale] || session['backend_locale'] || I18n.locale
  session['backend_locale'] = new_locale.to_s
  return if I18n.locale == new_locale || !I18n.locale_available?(new_locale)
  I18n.locale = new_locale
end