Class: BlockEditor::Blocks::Base
- Inherits:
-
Object
- Object
- BlockEditor::Blocks::Base
- Defined in:
- lib/block_editor/blocks/base.rb
Overview
Base for dynamic blocks
Direct Known Subclasses
Class Method Summary collapse
-
.controller ⇒ Object
Frontend controller used to render views.
-
.default_options ⇒ Object
Default widget options.
- .name ⇒ Object
-
.render(options = {}) ⇒ Object
Render the block.
Class Method Details
.controller ⇒ Object
Frontend controller used to render views
22 23 24 |
# File 'lib/block_editor/blocks/base.rb', line 22 def self.controller BlockEditor.frontend_parent_controller.constantize end |
.default_options ⇒ Object
Default widget options
27 28 29 |
# File 'lib/block_editor/blocks/base.rb', line 27 def self. {} end |
.name ⇒ Object
6 7 8 |
# File 'lib/block_editor/blocks/base.rb', line 6 def self.name raise NotImplementedError, 'Must specify block name' end |
.render(options = {}) ⇒ Object
Render the block
11 12 13 14 15 16 17 18 19 |
# File 'lib/block_editor/blocks/base.rb', line 11 def self.render( = {}) = .reverse_merge(.with_indifferent_access) controller.render( partial: "block_editor/blocks/#{name}/block", locals: { options: }, layout: false ) end |