Class: Spina::Parts::ContentBlocks
- Inherits:
-
Base
- Object
- Base
- Spina::Parts::ContentBlocks
- Includes:
- AttrJson::NestedAttributes
- Defined in:
- app/models/spina/parts/content_blocks.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#available_templates(theme) ⇒ Object
Returns available content block templates from the theme, optionally filtered by the :content_block_templates option.
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
11 12 13 |
# File 'app/models/spina/parts/content_blocks.rb', line 11 def @options end |
Instance Method Details
#available_templates(theme) ⇒ Object
Returns available content block templates from the theme, optionally filtered by the :content_block_templates option.
15 16 17 18 19 20 21 22 |
# File 'app/models/spina/parts/content_blocks.rb', line 15 def available_templates(theme) templates = theme.content_block_templates || [] allowed = &.dig(:content_block_templates) return templates if allowed.blank? allowed_names = Array(allowed).map(&:to_s) templates.select { |t| allowed_names.include?(t[:name].to_s) } end |