Class: SirTrevorRails::Blocks::SearchResultsBlock
- Inherits:
-
SirTrevorRails::Block
- Object
- SirTrevorRails::Block
- SirTrevorRails::Blocks::SearchResultsBlock
show all
- Includes:
- Displayable
- Defined in:
- app/models/sir_trevor_rails/blocks/search_results_block.rb
Overview
Embed search results (from a browse category) into the page
Instance Method Summary
collapse
#item_ids, #items, #ordered_items
Instance Method Details
#query_params ⇒ Object
8
9
10
11
12
13
14
|
# File 'app/models/sir_trevor_rails/blocks/search_results_block.rb', line 8
def query_params
if search
search.query_params
else
{}
end
end
|
#search ⇒ Object
16
17
18
|
# File 'app/models/sir_trevor_rails/blocks/search_results_block.rb', line 16
def search
searches.first
end
|
#searches ⇒ Object
20
21
22
|
# File 'app/models/sir_trevor_rails/blocks/search_results_block.rb', line 20
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
|
#searches? ⇒ Boolean
24
25
26
|
# File 'app/models/sir_trevor_rails/blocks/search_results_block.rb', line 24
def searches?
!searches.empty?
end
|