Sha256: 9a99a077db0413434f380f2496ce7eec72eb2a2eefe267a25c2cbdb1f7a0c1c9

Contents?: true

Size: 646 Bytes

Versions: 81

Compression:

Stored size: 646 Bytes

Contents

# frozen_string_literal: true

module SirTrevorRails
  module Blocks
    ##
    # Embed search results (from a browse category) into the page
    class SearchResultsBlock < SirTrevorRails::Block
      include Displayable

      def query_params
        if search
          search.query_params
        else
          {}
        end
      end

      def search
        searches.first
      end

      def searches
        @searches ||= parent.exhibit.searches.published.where(slug: item_ids).sort { |a, b| ordered_items.index(a.id) <=> ordered_items.index(b.id) }
      end

      def searches?
        !searches.empty?
      end
    end
  end
end

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
blacklight-spotlight-4.7.0 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.6.1 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.6.0 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.5.0 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.4.0 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.3.6 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.3.5 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.3.4 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.3.3 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.3.2 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.3.1 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.3.0 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.2.0 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.1.2 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.1.1 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.1.0 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.0.3 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.0.2 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.0.1 app/models/sir_trevor_rails/blocks/search_results_block.rb
blacklight-spotlight-4.0.0 app/models/sir_trevor_rails/blocks/search_results_block.rb