Sha256: dc52027da8864f9a85a0671ede885153cddd5521825535d59c7c8bc920ec768c

Contents?: true

Size: 807 Bytes

Versions: 5

Compression:

Stored size: 807 Bytes

Contents

class SearchHistoryController < ApplicationController
  def index
    @searches = searches_from_history
  end
  
  #TODO we may want to remove unsaved (those without user_id) items from the database when removed from history
  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
  
  #TODO we may want to remove unsaved (those without user_id) items from the database when removed from history
  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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-3.0.0pre6 app/controllers/search_history_controller.rb
blacklight-3.0.0pre4 app/controllers/search_history_controller.rb
blacklight-3.0.0pre3 app/controllers/search_history_controller.rb
blacklight-3.0pre2 app/controllers/search_history_controller.rb
blacklight-3.0pre1 app/controllers/search_history_controller.rb