Class: SirTrevorRails::Blocks::BrowseGroupCategoriesBlock
- Inherits:
-
SirTrevorRails::Block
- Object
- OpenStruct
- SirTrevorRails::Block
- SirTrevorRails::Blocks::BrowseGroupCategoriesBlock
- Includes:
- Displayable
- Defined in:
- app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb
Overview
Browese Group Categories
Constant Summary
Constants inherited from SirTrevorRails::Block
SirTrevorRails::Block::DEFAULT_FORMAT
Instance Attribute Summary
Attributes inherited from SirTrevorRails::Block
Instance Method Summary collapse
Methods included from Displayable
#item_ids, #items, #ordered_items
Methods inherited from SirTrevorRails::Block
#alt_text?, alt_text?, #as_json, block_class, block_class!, custom_block_type_alt_text_settings, custom_block_types, #format, from_hash, #initialize, #to_partial_path, type_klass
Constructor Details
This class inherits a constructor from SirTrevorRails::Block
Instance Method Details
#display_item_counts? ⇒ Boolean
10 11 12 |
# File 'app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb', line 10 def display_item_counts? send(:'display-item-counts') == 'true' end |
#groups ⇒ Object
14 15 16 17 18 |
# File 'app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb', line 14 def groups @groups ||= parent.exhibit.groups.published.where(slug: item_ids).sort do |a, b| ordered_items.index(a.slug) <=> ordered_items.index(b.slug) end end |
#groups? ⇒ Boolean
20 21 22 |
# File 'app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb', line 20 def groups? !groups.empty? end |