From 0433d52a19654932a0ab5b59eb6fe22fe2257b67 Mon Sep 17 00:00:00 2001 From: Kosuke Tanabe Date: Thu, 14 Jul 2016 18:33:04 +0900 Subject: [PATCH] add store_current_location and remove solr_commit --- app/controllers/concerns/enju_leaf/controller.rb | 15 +++++---------- app/controllers/page_controller.rb | 1 - 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/controllers/concerns/enju_leaf/controller.rb b/app/controllers/concerns/enju_leaf/controller.rb index ffa72e32bf..bbb9f7d544 100644 --- a/app/controllers/concerns/enju_leaf/controller.rb +++ b/app/controllers/concerns/enju_leaf/controller.rb @@ -4,6 +4,7 @@ module Controller included do before_action :get_library_group, :set_locale, :set_available_languages, :set_mobile_request + before_action :store_current_location, unless: :devise_controller? rescue_from Pundit::NotAuthorizedError, with: :render_403 #rescue_from ActiveRecord::RecordNotFound, with: :render_404 rescue_from Errno::ECONNREFUSED, with: :render_500_nosolr @@ -156,12 +157,6 @@ def store_page end end - def store_location - if request.get? and request.format.try(:html?) and !request.xhr? - session[:user_return_to] = request.fullpath - end - end - def set_role_query(user, search) role = user.try(:role) || Role.default_role search.build do @@ -169,10 +164,6 @@ def set_role_query(user, search) end end - def solr_commit - Sunspot.commit - end - def get_version @version = params[:version_id].to_i if params[:version_id] @version = nil if @version == 0 @@ -226,5 +217,9 @@ def move_position(resource, direction, redirect = true) end end end + + def store_current_location + store_location_for(:user, request.url) + end end end diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 6563a2d07b..15ea95ea74 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -1,7 +1,6 @@ class PageController < ApplicationController before_action :skip_authorization before_action :clear_search_sessions, only: [:index, :advanced_search] - before_action :store_location, only: [:advanced_search, :about, :add_on, :msie_accelerator, :statistics] before_action :authenticate_user!, except: [:index, :advanced_search, :about, :add_on, :msie_accelerator, :opensearch, :statistics, :routing_error] before_action :check_librarian, except: [:index, :advanced_search, :about, :add_on, :msie_accelerator, :opensearch, :statistics, :routing_error] helper_method :get_libraries