Sha256: ed44aa6aba0bee92120fba1c60083edb09706ad1f158e1b51df52992d7d4c3db

Contents?: true

Size: 1018 Bytes

Versions: 13

Compression:

Stored size: 1018 Bytes

Contents

module Spotlight
  ##
  # Helper for browse views
  module BrowseHelper
    include ::BlacklightConfigurationHelper
    include Spotlight::RenderingHelper

    def document_index_view_type
      if @search && @search.default_index_view_type.present? && params[:view].blank?
        blacklight_config.view[@search.default_index_view_type].key
      else
        super
      end
    end

    ##
    # Override Blacklight's #default_document_index_view_type helper to
    # use a different default view when presenting browse categories
    def default_document_index_view_type
      if view_available? default_browse_index_view_type
        default_browse_index_view_type
      else
        super
      end
    end

    private

    def view_available?(view)
      blacklight_config.view.key?(view) && blacklight_configuration_context.evaluate_if_unless_configuration(blacklight_config.view)
    end

    def default_browse_index_view_type
      Spotlight::Engine.config.default_browse_index_view_type
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
blacklight-spotlight-1.3.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-1.2.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-1.1.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-1.0.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-1.0.0.alpha2 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-1.0.0.alpha1 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.34.1 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.34.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.33.3 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.33.2 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.33.1 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.33.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.32.0 app/helpers/spotlight/browse_helper.rb