Class: Decidim::ContentBlockManifest
- Inherits:
-
Object
- Object
- Decidim::ContentBlockManifest
- Includes:
- ActiveModel::Model
- Defined in:
- lib/decidim/content_block_manifest.rb
Overview
This class acts as a manifest for content blocks.
A content block is a view section in a given page. Those sections can be registered by Decidim modules, and are configurable and sortable. They are a useful way to customize a given page, without having to rely on overwriting the views files. Also, this system is more powerful than basic view hooks (see the ‘ViewHooks` class for reference), as view hooks don’t have a way to explicitly control the order of the hooked views.
Content blocks are intended to be used in the home page, for example.
A content block has a set of settings and an associated ‘cell` that will handle the layout logic. They can also have attached images that can be used as background images, for example. You must explicitly specify the number of images the block will have (this means the number of attached images cannot be configurable). Each content block is identified by a name, which has to be unique per scope.
Instance Method Summary collapse
Instance Method Details
#has_settings? ⇒ Boolean
36 37 38 |
# File 'lib/decidim/content_block_manifest.rb', line 36 def has_settings? settings.attributes.any? end |
#settings {|@settings| ... } ⇒ Object
40 41 42 43 44 |
# File 'lib/decidim/content_block_manifest.rb', line 40 def settings(&block) @settings ||= SettingsManifest.new yield(@settings) if block @settings end |