Sha256: f5149dec0d81f7fe1d09e7feb3f5fe0afd46c484f78d790c77260ee24c5d0651
Contents?: true
Size: 1.78 KB
Versions: 21
Compression:
Stored size: 1.78 KB
Contents
# Note: not sure we're still using this in hydrangea... # This is a replica of some methods that are in Blacklight's CatalogController that we wanted to re-use in other controllers module Blacklight::CatalogHelper # calls setup_previous_document then setup_next_document. # used in the show action for single view pagination. def setup_next_and_previous_documents setup_previous_document setup_next_document end # gets a document based on its position within a resultset def setup_document_by_counter(counter) return if counter < 1 || session[:search].blank? # need to duplicate search session hash so we aren't modifying the original (and don't get the qt in the Back to search results link) search = session[:search].dup || {} # enforcing search restrictions # if the user is not a reader then use the pulic qt, otherwise use the default qt (using logic from enforce_search_permissions method) if !reader? search[:qt] = Blacklight.config[:public_qt] end get_single_doc_via_search(search.merge({:page => counter})) end def setup_previous_document @previous_document = session[:search][:counter] ? setup_document_by_counter(session[:search][:counter].to_i - 1) : nil end def setup_next_document @next_document = session[:search][:counter] ? setup_document_by_counter(session[:search][:counter].to_i + 1) : nil end # sets up the session[:search] hash if it doesn't already exist def search_session session[:search] ||= {} end # sets up the session[:history] hash if it doesn't already exist. # assigns all Search objects (that match the searches in session[:history]) to a variable @searches. def history_session session[:history] ||= [] @searches = searches_from_history # <- in ApplicationController end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
hydra-head-3.0.0pre4 | lib/blacklight/catalog_helper.rb |