app/helpers/spotlight/browse_helper.rb in blacklight-spotlight-0.18.0 vs app/helpers/spotlight/browse_helper.rb in blacklight-spotlight-0.19.0

- old
+ new

@@ -1,18 +1,33 @@ 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 - (default_browse_index_view_type if blacklight_config.view.key? default_browse_index_view_type) || super + 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