Sha256: 0363772587a3b31aa47bdd18e872066f519061a50927a1add2c3bb1f877cb0f7
Contents?: true
Size: 1.05 KB
Versions: 16
Compression:
Stored size: 1.05 KB
Contents
module SirTrevorRails module Blocks ## # Multi-up browse block class BrowseBlock < SirTrevorRails::Block attr_reader :solr_helper def with_solr_helper(solr_helper) @solr_helper = solr_helper end def search_options(id) (items.detect { |x| x[:id] == id }) || {} end def searches @searches ||= parent.exhibit.searches.published.where(slug: item_ids).sort do |a, b| order.index(a.slug) <=> order.index(b.slug) end end def searches? !searches.empty? end def item_ids items.map { |v| v[:id] } end def items item.values.select { |x| x[:display] == 'true' } end def order items.sort_by { |x| x[:weight] }.map { |x| x[:id] } end def display_item_counts? send(:'display-item-counts') == 'true' end def item_count(category) solr_helper.search_results(category.query_params, solr_helper.search_params_logic).first['response']['numFound'] end end end end
Version data entries
16 entries across 16 versions & 1 rubygems