Class: Katalyst::Content::Editor::BaseComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Katalyst::Content::Editor::BaseComponent
- Includes:
- HtmlAttributes
- Defined in:
- app/components/katalyst/content/editor/base_component.rb
Direct Known Subclasses
ErrorsComponent, ItemComponent, ItemEditorComponent, NewItemComponent, NewItemsComponent, RowComponent, StatusBarComponent, TableComponent, Katalyst::Content::EditorComponent
Instance Attribute Summary collapse
-
#container ⇒ Object
Returns the value of attribute container.
-
#item ⇒ Object
Returns the value of attribute item.
Instance Method Summary collapse
- #attributes_scope ⇒ Object
- #call ⇒ Object
- #container_form_id ⇒ Object
-
#initialize(container:, item: nil) ⇒ BaseComponent
constructor
A new instance of BaseComponent.
- #inspect ⇒ Object
Constructor Details
#initialize(container:, item: nil) ⇒ BaseComponent
Returns a new instance of BaseComponent.
13 14 15 16 17 18 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 13 def initialize(container:, item: nil, **) super(**) @container = container @item = item end |
Instance Attribute Details
#container ⇒ Object
Returns the value of attribute container.
9 10 11 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 9 def container @container end |
#item ⇒ Object
Returns the value of attribute item.
9 10 11 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 9 def item @item end |
Instance Method Details
#attributes_scope ⇒ Object
26 27 28 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 26 def attributes_scope "#{container.model_name.param_key}[items_attributes][]" end |
#call ⇒ Object
20 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 20 def call; end |
#container_form_id ⇒ Object
22 23 24 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 22 def container_form_id dom_id(container, :items) end |
#inspect ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 30 def inspect if item.present? "<#{self.class.name} container: #{container.inspect}, item: #{item.inspect}>" else "<#{self.class.name} container: #{container.inspect}>" end end |