Class: Katalyst::Content::EditorComponent
- Inherits:
-
Katalyst::Content::Editor::BaseComponent
- Object
- ViewComponent::Base
- Katalyst::Content::Editor::BaseComponent
- Katalyst::Content::EditorComponent
- Defined in:
- app/components/katalyst/content/editor_component.rb
Constant Summary collapse
- ACTIONS =
<<~ACTIONS.gsub(/\s+/, " ").freeze submit->#{CONTAINER_CONTROLLER}#reindex content:drop->#{CONTAINER_CONTROLLER}#drop content:reindex->#{CONTAINER_CONTROLLER}#reindex turbo:render@document->#{CONTAINER_CONTROLLER}#connect content:reset->#{CONTAINER_CONTROLLER}#reset ACTIONS
Constants inherited from Katalyst::Content::Editor::BaseComponent
Katalyst::Content::Editor::BaseComponent::CONTAINER_CONTROLLER, Katalyst::Content::Editor::BaseComponent::ITEM_CONTROLLER, Katalyst::Content::Editor::BaseComponent::LIST_CONTROLLER, Katalyst::Content::Editor::BaseComponent::NEW_ITEMS_CONTROLLER, Katalyst::Content::Editor::BaseComponent::STATUS_BAR_CONTROLLER
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from Katalyst::Content::Editor::BaseComponent
Instance Method Summary collapse
- #default_html_attributes ⇒ Object
- #errors ⇒ Object
-
#initialize(container:, url: [:admin, container], scope: :container) ⇒ EditorComponent
constructor
A new instance of EditorComponent.
- #item(item:) ⇒ Object
- #item_editor(item:) ⇒ Object
-
#new_items ⇒ Object
deprecated
Deprecated.
this component is now part of the editor
- #status_bar ⇒ Object
Methods inherited from Katalyst::Content::Editor::BaseComponent
#attributes_scope, #call, #container_form_id, #inspect
Constructor Details
#initialize(container:, url: [:admin, container], scope: :container) ⇒ EditorComponent
Returns a new instance of EditorComponent.
16 17 18 19 20 21 |
# File 'app/components/katalyst/content/editor_component.rb', line 16 def initialize(container:, url: [:admin, container], scope: :container, **) super(container:, **) @url = url @scope = scope end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
14 15 16 |
# File 'app/components/katalyst/content/editor_component.rb', line 14 def scope @scope end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
14 15 16 |
# File 'app/components/katalyst/content/editor_component.rb', line 14 def url @url end |
Instance Method Details
#default_html_attributes ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'app/components/katalyst/content/editor_component.rb', line 45 def default_html_attributes { id: container_form_id, data: { controller: CONTAINER_CONTROLLER, action: ACTIONS, }, } end |
#errors ⇒ Object
41 42 43 |
# File 'app/components/katalyst/content/editor_component.rb', line 41 def errors Katalyst::Content.config.errors_component.constantize.new(container:) end |
#item(item:) ⇒ Object
37 38 39 |
# File 'app/components/katalyst/content/editor_component.rb', line 37 def item(item:) Editor::ItemComponent.new(container:, item:) end |
#item_editor(item:) ⇒ Object
33 34 35 |
# File 'app/components/katalyst/content/editor_component.rb', line 33 def item_editor(item:) Editor::ItemEditorComponent.new(container:, item:) end |
#new_items ⇒ Object
Deprecated.
this component is now part of the editor
28 29 30 31 |
# File 'app/components/katalyst/content/editor_component.rb', line 28 def new_items # no-op, no longer required Class.new { define_method(:render_in) { |_| nil } }.new end |
#status_bar ⇒ Object
23 24 25 |
# File 'app/components/katalyst/content/editor_component.rb', line 23 def Editor::StatusBarComponent.new(container:) end |