Module: Katalyst::Content::EditorHelper

Defined in:
app/helpers/katalyst/content/editor_helper.rb

Instance Method Summary collapse

Instance Method Details

#content_editor_container(container:, **options, &block) ⇒ Object



13
14
15
# File 'app/helpers/katalyst/content/editor_helper.rb', line 13

def content_editor_container(container:, **options, &block)
  Editor::Container.new(self, container).build(options, &block)
end

#content_editor_item(item:, container: item.container, **options, &block) ⇒ Object



33
34
35
# File 'app/helpers/katalyst/content/editor_helper.rb', line 33

def content_editor_item(item:, container: item.container, **options, &block)
  Editor::Item.new(self, container).build(item, **options, &block)
end

#content_editor_items(item:, container: item.container) ⇒ Object

Generate items without their list wrapper, similar to form_with/fields



24
25
26
# File 'app/helpers/katalyst/content/editor_helper.rb', line 24

def content_editor_items(item:, container: item.container)
  Editor::List.new(self, container).items(item)
end

#content_editor_list(container:, items: container.draft_items, **options) ⇒ Object



17
18
19
20
21
# File 'app/helpers/katalyst/content/editor_helper.rb', line 17

def content_editor_list(container:, items: container.draft_items, **options)
  Editor::List.new(self, container).build(options) do |list|
    list.items(*items) if items.present?
  end
end

#content_editor_new_item(item:, container: item.container, **options, &block) ⇒ Object

Gene



29
30
31
# File 'app/helpers/katalyst/content/editor_helper.rb', line 29

def content_editor_new_item(item:, container: item.container, **options, &block)
  Editor::NewItem.new(self, container).build(item, **options, &block)
end

#content_editor_new_items(container:) ⇒ Object



6
7
8
9
10
11
# File 'app/helpers/katalyst/content/editor_helper.rb', line 6

def content_editor_new_items(container:)
  Katalyst::Content.config.items.map do |item_class|
    item_class = item_class.is_a?(String) ? item_class.safe_constantize : item_class
    item_class.new(container: container)
  end
end

#content_editor_status_bar(container:, **options) ⇒ Object



37
38
39
# File 'app/helpers/katalyst/content/editor_helper.rb', line 37

def content_editor_status_bar(container:, **options)
  Editor::StatusBar.new(self, container).build(**options)
end