Module: SirTrevorRails::Blocks::Displayable

Included in:
BrowseBlock, BrowseGroupCategoriesBlock, 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



12
13
14
# File 'app/models/sir_trevor_rails/blocks/displayable.rb', line 12

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

#itemsObject



8
9
10
# File 'app/models/sir_trevor_rails/blocks/displayable.rb', line 8

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

#ordered_itemsObject



16
17
18
# File 'app/models/sir_trevor_rails/blocks/displayable.rb', line 16

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