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

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/katalyst/content/editor/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, #initialize, #inspect

Constructor Details

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

Instance Method Details

#default_html_attributesObject



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

def default_html_attributes
  {
    id:   dom_id(item),
    data: {
      controller: "content--editor--item",
    },
  }
end


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

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