class BlockEditor::Blocks::Base
Base
for dynamic blocks
Public Class Methods
controller()
click to toggle source
Frontend controller used to render views
# File lib/block_editor/blocks/base.rb, line 22 def self.controller BlockEditor.frontend_parent_controller.constantize end
default_options()
click to toggle source
Default widget options
# File lib/block_editor/blocks/base.rb, line 27 def self.default_options {} end
name()
click to toggle source
# File lib/block_editor/blocks/base.rb, line 6 def self.name raise NotImplementedError, 'Must specify block name' end
render(options = {})
click to toggle source
Render the block
# File lib/block_editor/blocks/base.rb, line 11 def self.render(options = {}) options = options.reverse_merge(default_options.with_indifferent_access) controller.render( partial: "block_editor/blocks/#{name}/block", locals: { options: options }, layout: false ) end