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
Instance Attribute Summary
#container, #item
Instance Method Summary
collapse
#attributes_scope, #container_form_id, #initialize, #inspect
Instance Method Details
#before_render ⇒ Object
17
18
19
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 17
def before_render
helpers.extend(Helpers)
end
|
#call ⇒ Object
21
22
23
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 21
def call
render("form", model:, scope:, url:, id:)
end
|
#id ⇒ Object
25
26
27
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 25
def id
dom_id(item, :form)
end
|
#scope ⇒ Object
29
30
31
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 29
def scope
:item
end
|
#title ⇒ Object
33
34
35
36
37
38
39
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 33
def title
if item.persisted?
"Edit #{item.model_name.human.downcase}"
else
"New #{item.model_name.human.downcase}"
end
end
|
#url ⇒ Object
41
42
43
44
45
46
47
|
# File 'app/components/katalyst/content/editor/item_editor_component.rb', line 41
def url
if item.persisted?
view_context.katalyst_content.item_path(item)
else
view_context.katalyst_content.items_path
end
end
|