app/controllers/spotlight/pages_controller.rb in blacklight-spotlight-2.13.0 vs app/controllers/spotlight/pages_controller.rb in blacklight-spotlight-3.0.0.alpha.1

- old
+ new

@@ -11,15 +11,20 @@ before_action :load_locale_specific_page, only: [:destroy, :edit, :show, :update] load_and_authorize_resource :exhibit, class: Spotlight::Exhibit load_and_authorize_resource through: :exhibit, instance_name: 'page', only: [:index] helper Openseadragon::OpenseadragonHelper + include Spotlight::SearchHelper include Spotlight::Base include Blacklight::SearchContext - helper_method :get_search_results, :search_results, :fetch, :page_collection_name + helper_method :get_search_results, :search_results, :fetch, :page_collection_name, :presenter + before_action do + blacklight_config.track_search_session = false + end + # GET /exhibits/1/pages def index # set up a model the inline "add a new page" form @page = CanCan::ControllerResource.new(self).send(:build_resource) @@ -109,12 +114,21 @@ def _prefixes @_prefixes ||= super + ['catalog'] end + # Add a Page specific search_results method that takes user params as + # an option and passes that off to the search service to get results + # @param [Hash] the query parameters + # @return [Object] the search results object from the configured search service + def search_results(user_params) + search_service(user_params).search_results + end + def undo_link return unless can? :manage, @page + return if @page.versions.blank? view_context.link_to(t(:'spotlight.versions.undo'), revert_version_path(@page.versions.last), method: :post) end def undo_notice(key) @@ -194,9 +208,13 @@ elsif pages_for_id.translated_page_for(I18n.locale) redirect_to polymorphic_path([current_exhibit, pages_for_id.translated_page_for(I18n.locale)]) else raise ActiveRecord::RecordNotFound end + end + + def presenter(document) + view_context.index_presenter(document) end end # rubocop:enable Metrics/ClassLength end