Module: SirTrevorRails::Blocks::Displayable

Included in:
BrowseBlock, FeaturedPagesBlock, LinkToSearchBlock, SearchResultsBlock, SolrDocumentsBlock
Defined in:
app/models/sir_trevor_rails/blocks/displayable.rb

Overview

Mixin for blocks that display text

Instance Method Summary collapse

Instance Method Details

#item_idsObject



10
11
12
# File 'app/models/sir_trevor_rails/blocks/displayable.rb', line 10

def item_ids
  items.map { |v| v[:id] }
end

#itemsObject



6
7
8
# File 'app/models/sir_trevor_rails/blocks/displayable.rb', line 6

def items
  item_values.select { |x| x[:display] == 'true' }
end

#ordered_itemsObject



14
15
16
# File 'app/models/sir_trevor_rails/blocks/displayable.rb', line 14

def ordered_items
  items.sort_by { |x| x[:weight] }.map { |x| x[:id] }
end