Class: SirTrevorRails::Blocks::LinkToSearchBlock

Inherits:
BrowseBlock
  • Object
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

Instance Attribute Summary

Attributes inherited from BrowseBlock

#solr_helper

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

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