Class: Lato::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
Componentable, Layoutable, Sessionable
Defined in:
app/controllers/lato/application_controller.rb

Instance Method Summary collapse

Methods included from Componentable

#lato_index_collection

Methods included from Layoutable

#active_navbar, #active_sidebar, #hide_sidebar, #page_class, #page_classes, #page_title, #show_sidebar

Methods included from Sessionable

#authenticate_session, #limit_requests, #not_authenticate_session, #session_create, #session_destroy

Instance Method Details

#errorObject



27
28
29
# File 'app/controllers/lato/application_controller.rb', line 27

def error
  respond_to_with_error
end

#indexObject



14
15
16
17
# File 'app/controllers/lato/application_controller.rb', line 14

def index
  session_root_path = Lato.config.session_root_path ? main_app.send(Lato.config.session_root_path) : lato.
  redirect_to @session.really_valid? ? session_root_path : lato.
end

#not_foundObject



23
24
25
# File 'app/controllers/lato/application_controller.rb', line 23

def not_found
  respond_to_with_not_found
end

#offlineObject



19
20
21
# File 'app/controllers/lato/application_controller.rb', line 19

def offline
  respond_to_with_offline
end

#switch_localeObject



31
32
33
34
35
36
# File 'app/controllers/lato/application_controller.rb', line 31

def switch_locale
  locale = I18n.available_locales.map(&:to_s).include?(params[:locale]) ? params[:locale] : I18n.default_locale.to_s
  @session.user.update(locale: locale) if @session.valid?
  cookies[:lato_locale] = { value: locale, expires: 1.year.from_now }
  respond_to_redirect_same_page
end