Class: SirTrevorRails::Blocks::LinkToSearchBlock

Inherits:
BrowseBlock show all
Includes:
Displayable
Defined in:
app/models/sir_trevor_rails/blocks/link_to_search_block.rb

Overview

Embed search results (from a browse category) into the page

Constant Summary

Constants inherited from SirTrevorRails::Block

SirTrevorRails::Block::DEFAULT_FORMAT

Instance Attribute Summary

Attributes inherited from BrowseBlock

#solr_helper

Attributes inherited from SirTrevorRails::Block

#parent, #type

Instance Method Summary collapse

Methods included from Displayable

#item_ids, #items, #ordered_items

Methods inherited from BrowseBlock

#as_json, #display_item_counts?, #search_options, #searches?, #with_solr_helper

Methods inherited from SirTrevorRails::Block

#as_json, block_class, block_class!, custom_block_types, #format, from_hash, #initialize, #to_partial_path, type_klass

Constructor Details

This class inherits a constructor from SirTrevorRails::Block

Instance Method Details

#searchesObject



10
11
12
13
14
# File 'app/models/sir_trevor_rails/blocks/link_to_search_block.rb', line 10

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