Class: Pwb::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Pwb::ApplicationController
- Defined in:
- app/controllers/pwb/application_controller.rb
Direct Known Subclasses
ContactUsController, DeviseController, OmniauthController, PagesController, PropsController, SearchController, WelcomeController
Class Method Summary collapse
-
.default_url_options ⇒ Object
www.rubydoc.info/github/plataformatec/devise/master/ActionDispatch/Routing/Mapper#devise_for-instance_method below needed so devise can route links with correct locale.
Instance Method Summary collapse
Class Method Details
.default_url_options ⇒ Object
www.rubydoc.info/github/plataformatec/devise/master/ActionDispatch/Routing/Mapper#devise_for-instance_method below needed so devise can route links with correct locale
41 42 43 |
# File 'app/controllers/pwb/application_controller.rb', line 41 def self. { locale: I18n.locale } end |
Instance Method Details
#set_locale ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/pwb/application_controller.rb', line 23 def set_locale # agency = current_agency locale = Website.unique_instance.default_client_locale_to_use # below just causes confusion for now # if current_user # locale = current_user.default_client_locale # end if params[:locale] && (I18n.locale_available? params[:locale]) # passed in params override user's default locale = params[:locale] end I18n.locale = locale.to_sym # Globalize.fallbacks = {:de => [:en],:es => [:en], :ru => [:en]} end |
#set_theme_path ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/pwb/application_controller.rb', line 8 def set_theme_path theme_name = Website.unique_instance.theme_name if params[:theme].present? if %w(berlin default).include? params[:theme] theme_name = params[:theme] end end theme_name = theme_name.present? ? theme_name : "default" prepend_view_path "#{Pwb::Engine.root}/app/themes/#{theme_name}/views/" # below allows themes installed in Rails app consuming Pwb to work prepend_view_path "#{Rails.root}/app/themes/#{theme_name}/views/" self.class.layout "#{Pwb::Engine.root}/app/themes/#{theme_name}/views/layouts/pwb/application" end |