Class: Katalyst::Content::Editor::ItemEditorComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Katalyst::Content::Editor::ItemEditorComponent
show all
- Includes:
- Turbo::FramesHelper
- Defined in:
- app/components/katalyst/content/editor/item_editor_component.rb
Defined Under Namespace
Modules: Helpers
Constant Summary
BaseComponent::CONTAINER_CONTROLLER, BaseComponent::ITEM_CONTROLLER, BaseComponent::LIST_CONTROLLER, BaseComponent::NEW_ITEM_CONTROLLER, BaseComponent::STATUS_BAR_CONTROLLER
Instance Attribute Summary
#container, #item
Instance Method Summary
collapse
#attributes_scope, #container_form_id, #initialize, #inspect
Instance Method Details
#call ⇒ Object
19
20
21
22
23
24
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 19
def call
tag.div(**html_attributes) do
helpers.extend(Helpers)
helpers.render(item, path:)
end
end
|
#default_html_attributes ⇒ Object
46
47
48
49
50
51
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 46
def default_html_attributes
{
id:,
class: "content--item-editor",
}
end
|
#id ⇒ Object
26
27
28
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 26
def id
"item-editor-#{item.id}"
end
|
#path ⇒ Object
38
39
40
41
42
43
44
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 38
def path
if item.persisted?
view_context.katalyst_content.item_path(item)
else
view_context.katalyst_content.items_path
end
end
|
#title ⇒ Object
30
31
32
33
34
35
36
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 30
def title
if item.persisted?
"Edit #{item.model_name.human.downcase}"
else
"New #{item.model_name.human.downcase}"
end
end
|