Class: Dashboard::V2::SessionsController
- Inherits:
-
Devise::SessionsController
- Object
- Devise::SessionsController
- Dashboard::V2::SessionsController
show all
- Includes:
- OwnerLoginMode
- Defined in:
- app/controllers/dashboard/v2/sessions_controller.rb
Overview
typed: ignore frozen_string_literal: true
Instance Method Summary
collapse
#current_owner, #group_owner_type?, #request_path_contain_group?, #single_owner_type?
Instance Method Details
#after_sign_in_path_for(resource) ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'app/controllers/dashboard/v2/sessions_controller.rb', line 11
def after_sign_in_path_for(resource)
create_staff
if resource.decorate.restaurants.count > 1
dashboard_v2_group_root_path
else
dashboard_v2_root_path
end
end
|
#after_sign_out_path_for(resource) ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/dashboard/v2/sessions_controller.rb', line 21
def after_sign_out_path_for(resource)
case resource
when :dashboard_v2_owner
new_dashboard_v2_owner_session_path
when :dashboard_v2_staff
new_dashboard_v2_staff_session_path
else
new_dashboard_v2_restaurant_group_session_path
end
end
|
#set_i18n_locale_from_params(&action) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/controllers/dashboard/v2/sessions_controller.rb', line 32
def set_i18n_locale_from_params(&action)
locale = if params[:locale].present?
locale = MyLocaleManager.parse params[:locale]
session[:locale] = locale
else
session[:locale] || I18n.locale || I18n.default_locale
end
I18n.with_locale(locale) do
Globalize.with_locale(locale, &action)
end
end
|