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
Constant Summary collapse
- CONTAINER_CONTROLLER =
"content--editor--container"
- LIST_CONTROLLER =
"content--editor--list"
- ITEM_CONTROLLER =
"content--editor--item"
- STATUS_BAR_CONTROLLER =
"content--editor--status-bar"
- NEW_ITEM_CONTROLLER =
"content--editor--new-item"
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.
19 20 21 22 23 24 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 19 def initialize(container:, item: nil, **) super(**) @container = container @item = item end |
Instance Attribute Details
#container ⇒ Object
Returns the value of attribute container.
15 16 17 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 15 def container @container end |
#item ⇒ Object
Returns the value of attribute item.
15 16 17 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 15 def item @item end |
Instance Method Details
#attributes_scope ⇒ Object
32 33 34 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 32 def attributes_scope "#{container.model_name.param_key}[items_attributes][]" end |
#call ⇒ Object
26 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 26 def call; end |
#container_form_id ⇒ Object
28 29 30 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 28 def container_form_id dom_id(container, :items) end |
#inspect ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/components/katalyst/content/editor/base_component.rb', line 36 def inspect if item.present? "<#{self.class.name} container: #{container.inspect}, item: #{item.inspect}>" else "<#{self.class.name} container: #{container.inspect}>" end end |