Sha256: 984d4134dcec42bbda14dd625356dc4722cfcddb37563e3d3c7958a44584f43c

Contents?: true

Size: 978 Bytes

Versions: 23

Compression:

Stored size: 978 Bytes

Contents

module Spotlight
  ##
  # Helper for browse views
  module BrowseHelper
    include ::BlacklightConfigurationHelper
    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

23 entries across 23 versions & 1 rubygems

Version Path
blacklight-spotlight-0.31.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.30.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.29.1 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.29.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.28.3 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.28.2 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.28.1 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.28.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.27.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.26.1 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.26.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.25.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.24.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.23.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.22.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.21.0 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.20.3 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.20.2 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.20.1 app/helpers/spotlight/browse_helper.rb
blacklight-spotlight-0.20.0 app/helpers/spotlight/browse_helper.rb