refactor and fixes for mobile
This commit is contained in:
@@ -1,14 +1,23 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
layout :layout_by_resource
|
||||
|
||||
|
||||
protect_from_forgery
|
||||
|
||||
private
|
||||
|
||||
def layout_by_resource
|
||||
if devise_controller?
|
||||
"phone"
|
||||
else
|
||||
"application"
|
||||
end
|
||||
end
|
||||
def check_active_list_state
|
||||
if session[:active_list_id]
|
||||
unless active_list.active?
|
||||
session[:active_list_id] = nil
|
||||
redirect_to phone_root_path, alert: t('messages.the_list_has_been_closed', list: List.model_name.human)
|
||||
redirect_to user_root_path, alert: t('messages.the_list_has_been_closed', list: List.model_name.human)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,6 +27,8 @@ class ApplicationController < ActionController::Base
|
||||
return nil unless session[:active_list_id].present?
|
||||
@active_list ||= List.find(session[:active_list_id])
|
||||
end
|
||||
alias :active_list_object :active_list
|
||||
helper_method :active_list_object
|
||||
|
||||
def js_alert(message)
|
||||
{ok: false, message: message}.to_json
|
||||
@@ -25,7 +36,4 @@ class ApplicationController < ActionController::Base
|
||||
def js_notice(message)
|
||||
{ok: true, message: message}.to_json
|
||||
end
|
||||
|
||||
|
||||
helper_method :active_list
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user