Sha256: c22de6a840851606a28370add7e64d7c17b68b24860a6465b137632b139dee46

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 Bytes

Contents

# -*- encoding : utf-8 -*-
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

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-3.0.0pre7 app/controllers/search_history_controller.rb