Module: Katalyst::Content::EditorHelper
- Defined in:
- app/helpers/katalyst/content/editor_helper.rb
Instance Method Summary collapse
- #content_editor_container(container:, **options, &block) ⇒ Object
- #content_editor_image_field(item:, method:, **options, &block) ⇒ Object
- #content_editor_item(item:, container: item.container, **options, &block) ⇒ Object
-
#content_editor_items(item:, container: item.container) ⇒ Object
Generate items without their list wrapper, similar to form_with/fields.
- #content_editor_list(container:, items: container.draft_items, **options) ⇒ Object
-
#content_editor_new_item(item:, container: item.container, **options, &block) ⇒ Object
Gene.
- #content_editor_new_items(container:) ⇒ Object
- #content_editor_rich_text_options(options = {}) ⇒ Object
- #content_editor_status_bar(container:, **options) ⇒ Object
-
#prefix_partial_path_with_controller_namespace ⇒ Object
When rendering item forms do not include the controller namespace prefix (katalyst/content).
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:, **, &block) Editor::Container.new(self, container).build(, &block) end |
#content_editor_image_field(item:, method:, **options, &block) ⇒ Object
52 53 54 |
# File 'app/helpers/katalyst/content/editor_helper.rb', line 52 def content_editor_image_field(item:, method:, **, &block) Editor::ImageField.new(self, item.container).build(item, method, **, &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, **, &block) Editor::Item.new(self, container).build(item, **, &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, **) Editor::List.new(self, container).build() 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, **, &block) Editor::NewItem.new(self, container).build(item, **, &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_rich_text_options(options = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'app/helpers/katalyst/content/editor_helper.rb', line 41 def ( = {}) defaults = { data: { direct_upload_url: direct_uploads_url, controller: "content--editor--trix", action: "trix-initialize->content--editor--trix#trixInitialize", }, } defaults.deep_merge() end |
#content_editor_status_bar(container:, **options) ⇒ Object
37 38 39 |
# File 'app/helpers/katalyst/content/editor_helper.rb', line 37 def (container:, **) Editor::StatusBar.new(self, container).build(**) end |
#prefix_partial_path_with_controller_namespace ⇒ Object
When rendering item forms do not include the controller namespace prefix (katalyst/content)
57 58 59 |
# File 'app/helpers/katalyst/content/editor_helper.rb', line 57 def prefix_partial_path_with_controller_namespace false end |