Class: Katalyst::Tables::Orderable::FormComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Katalyst::Tables::Orderable::FormComponent
- Includes:
- Identifiable::Defaults
- Defined in:
- app/components/katalyst/tables/orderable/form_component.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(collection:, url:, id: nil, scope: nil) ⇒ FormComponent
constructor
A new instance of FormComponent.
- #inspect ⇒ Object
Methods included from Identifiable::Defaults
Constructor Details
#initialize(collection:, url:, id: nil, scope: nil) ⇒ FormComponent
Returns a new instance of FormComponent.
15 16 17 18 19 20 21 |
# File 'app/components/katalyst/tables/orderable/form_component.rb', line 15 def initialize(collection:, url:, id: nil, scope: nil) super @id = id || Orderable.default_form_id(collection) @url = url @scope = scope || Orderable.default_scope(collection) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'app/components/katalyst/tables/orderable/form_component.rb', line 9 def id @id end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'app/components/katalyst/tables/orderable/form_component.rb', line 9 def url @url end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/components/katalyst/tables/orderable/form_component.rb', line 23 def call form_with(id:, url:, method: :patch, data: { controller: FORM_CONTROLLER, "#{FORM_CONTROLLER}-scope-value": @scope, }) do |form| form.(hidden: "") end end |
#inspect ⇒ Object
32 33 34 |
# File 'app/components/katalyst/tables/orderable/form_component.rb', line 32 def inspect "#<#{self.class.name} id: #{id.inspect}, url: #{url.inspect}>" end |