Class: SearchHistoryController

Inherits:
ApplicationController show all
Defined in:
vendor/plugins/blacklight/app/controllers/search_history_controller.rb

Instance Method Summary (collapse)

Methods inherited from ApplicationController

#current_user, #default_html_head, #error, #extra_head_content, #javascript_includes, #stylesheet_links, #user_class

Methods included from HydraAccessControlsHelper

#editor?, #reader?, #test_permission

Instance Method Details

- (Object) clear

TODO we may want to remove unsaved (those without user_id) items from the database when removed from history



17
18
19
20
21
22
23
24
# File 'vendor/plugins/blacklight/app/controllers/search_history_controller.rb', line 17

def clear
  if session[:history].clear
    flash[:notice] = "Cleared your search history."
  else
    flash[:error] = "There was a problem clearing your search history."
  end
  redirect_to :back
end

- (Object) destroy

TODO we may want to remove unsaved (those without user_id) items from the database when removed from history



7
8
9
10
11
12
13
14
# File 'vendor/plugins/blacklight/app/controllers/search_history_controller.rb', line 7

def destroy
  if session[:history].delete(params[:id].to_i)
    flash[:notice] = "Successfully removed that search history item."
  else
    flash[:error] = "Couldn't remove that search history item."
  end
  redirect_to :back
end

- (Object) index



2
3
4
# File 'vendor/plugins/blacklight/app/controllers/search_history_controller.rb', line 2

def index
  @searches = searches_from_history
end