Class: Katalyst::Content::Editor::NewItemComponent

Inherits:
BaseComponent
  • Object
show all
Includes:
Turbo::StreamsHelper
Defined in:
app/components/katalyst/content/editor/new_item_component.rb

Instance Attribute Summary

Attributes inherited from BaseComponent

#container, #item

Instance Method Summary collapse

Methods inherited from BaseComponent

#attributes_scope, #call, #container_form_id, #inspect

Constructor Details

#initialize(item:, container: item.container) ⇒ NewItemComponent

Returns a new instance of NewItemComponent.



11
12
13
# File 'app/components/katalyst/content/editor/new_item_component.rb', line 11

def initialize(item:, container: item.container)
  super
end

Instance Method Details

#item_componentObject



15
16
17
# File 'app/components/katalyst/content/editor/new_item_component.rb', line 15

def item_component(**)
  ItemComponent.new(item:, container:, **)
end

#item_typeObject Also known as: icon_name



27
28
29
# File 'app/components/katalyst/content/editor/new_item_component.rb', line 27

def item_type
  item.model_name.param_key
end

#labelObject



23
24
25
# File 'app/components/katalyst/content/editor/new_item_component.rb', line 23

def label
  t("katalyst.content.editor.new_item.#{item_type}", default: item.model_name.human)
end

#row_componentObject



19
20
21
# File 'app/components/katalyst/content/editor/new_item_component.rb', line 19

def row_component(**)
  RowComponent.new(item:, container:, **)
end