Class: Koi::Content::Editor::ItemFormComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Koi::Content::Editor::ItemFormComponent
- Includes:
- Katalyst::HtmlAttributes
- Defined in:
- app/components/koi/content/editor/item_form_component.rb
Defined Under Namespace
Modules: ContentFormHelper
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #content ⇒ Object
- #form_with(**options, &block) ⇒ Object
-
#initialize(model:, url:, builder: Koi::FormBuilder) ⇒ ItemFormComponent
constructor
A new instance of ItemFormComponent.
- #inspect ⇒ Object
Constructor Details
#initialize(model:, url:, builder: Koi::FormBuilder) ⇒ ItemFormComponent
Returns a new instance of ItemFormComponent.
11 12 13 14 15 16 17 |
# File 'app/components/koi/content/editor/item_form_component.rb', line 11 def initialize(model:, url:, builder: Koi::FormBuilder, **) super(**) @model = model @url = url @builder = builder end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
9 10 11 |
# File 'app/components/koi/content/editor/item_form_component.rb', line 9 def builder @builder end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
9 10 11 |
# File 'app/components/koi/content/editor/item_form_component.rb', line 9 def form @form end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
9 10 11 |
# File 'app/components/koi/content/editor/item_form_component.rb', line 9 def model @model end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'app/components/koi/content/editor/item_form_component.rb', line 9 def url @url end |
Instance Method Details
#content ⇒ Object
27 28 29 30 31 32 |
# File 'app/components/koi/content/editor/item_form_component.rb', line 27 def content @__vc_content_evaluated = true return @__vc_content if defined?(@__vc_content) @__vc_content = view_context.capture(@form, &@__vc_render_in_block) end |
#form_with(**options, &block) ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/components/koi/content/editor/item_form_component.rb', line 19 def form_with(**, &block) view_context.form_with(**) do |form| @form = form form.extend(ContentFormHelper) capture(form, &block) end end |
#inspect ⇒ Object
34 35 36 |
# File 'app/components/koi/content/editor/item_form_component.rb', line 34 def inspect "#<#{self.class.name} model: #{model.inspect} url: #{url.inspect}>" end |