Class: Katalyst::Content::Editor::ItemComponent

Inherits:
BaseComponent
  • Object
show all
Includes:
KpopHelper
Defined in:
app/components/katalyst/content/editor/item_component.rb

Constant Summary

Constants inherited from BaseComponent

BaseComponent::CONTAINER_CONTROLLER, BaseComponent::ITEM_CONTROLLER, BaseComponent::LIST_CONTROLLER, BaseComponent::NEW_ITEM_CONTROLLER, BaseComponent::STATUS_BAR_CONTROLLER

Instance Attribute Summary

Attributes inherited from BaseComponent

#container, #item

Instance Method Summary collapse

Methods inherited from BaseComponent

#attributes_scope, #call, #container_form_id, #initialize, #inspect

Constructor Details

This class inherits a constructor from Katalyst::Content::Editor::BaseComponent

Instance Method Details

#default_html_attributesObject



19
20
21
22
23
24
25
26
# File 'app/components/katalyst/content/editor/item_component.rb', line 19

def default_html_attributes
  {
    id:   dom_id(item),
    data: {
      controller: ITEM_CONTROLLER,
    },
  }
end


9
10
11
12
13
14
15
16
17
# File 'app/components/katalyst/content/editor/item_component.rb', line 9

def edit_item_link
  if item.persisted?
    helpers.katalyst_content.edit_item_path(item)
  else
    helpers.katalyst_content.new_item_path(
      item: item.attributes.slice("type", "container_id", "container_type").compact,
    )
  end
end