Sha256: 77ec24cdb626fc3b924a95daa85fbfb40bbbcd64b9c20765f2f8b81ab24069ed

Contents?: true

Size: 1.74 KB

Versions: 19

Compression:

Stored size: 1.74 KB

Contents

module Spotlight
  ##
  # Index and read actions for browse (see {Spotlight::SearchesController}
  # for the curator's create-update-delete actions)
  class BrowseController < Spotlight::ApplicationController
    load_and_authorize_resource :exhibit, class: 'Spotlight::Exhibit'
    include Spotlight::Base
    include Spotlight::Catalog::AccessControlsEnforcement

    load_and_authorize_resource :search, except: :index, through: :exhibit, parent: false
    before_action :attach_breadcrumbs
    record_search_parameters only: :show

    before_action :set_masthead, only: :show

    def index
      @searches = @exhibit.searches.published
    end

    def show
      blacklight_config.index.document_actions = blacklight_config.browse.document_actions

      add_breadcrumb @search.title, exhibit_browse_path(@exhibit, @search)
      (@response, @document_list) = search_results(@search.query_params.with_indifferent_access.merge(params), search_params_logic)
    end

    protected

    ##
    # Browsing an exhibit should start a new search session
    def start_new_search_session?
      params[:action] == 'show'
    end

    # WARNING: Blacklight::Catalog::SearchContext sets @searches in history_session in a before_filter
    # See https://github.com/projectblacklight/blacklight/pull/780
    def history_session
      # nop
    end

    def attach_breadcrumbs
      add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
      add_breadcrumb((@exhibit.main_navigations.browse.label_or_default), exhibit_browse_index_path(@exhibit))
    end

    def _prefixes
      @_prefixes ||= super + ['catalog']
    end

    def set_masthead
      self.current_masthead = @search.masthead if @search.masthead && @search.masthead.display?
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
blacklight-spotlight-0.13.0 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.12.1 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.12.0 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.11.0 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.10.3 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.10.2 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.10.1 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.10.0 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.9.2 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.9.1 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.9.0 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.8.2 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.8.1 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.8.0 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.7.2 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.7.1 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.7.0 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.6.0 app/controllers/spotlight/browse_controller.rb
blacklight-spotlight-0.5.0 app/controllers/spotlight/browse_controller.rb