Skip to content

Commit

Permalink
add store_current_location and remove solr_commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta committed Jul 14, 2016
1 parent af1f467 commit 0433d52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
15 changes: 5 additions & 10 deletions app/controllers/concerns/enju_leaf/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -156,23 +157,13 @@ 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
with(:required_role_id).less_than_or_equal_to role.id
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
Expand Down Expand Up @@ -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
1 change: 0 additions & 1 deletion app/controllers/page_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0433d52

Please sign in to comment.