Allow handing custom field names to toggle fieldset component

This commit is contained in:
Râu Cao
2023-04-04 12:03:00 +02:00
parent 334b47353e
commit a33410eeb4
2 changed files with 19 additions and 10 deletions
@@ -2,11 +2,13 @@
module FormElements
class FieldsetToggleComponent < ViewComponent::Base
def initialize(form: nil, attribute: nil, tag: "li", enabled: false,
input_enabled: true, title:, description:)
def initialize(tag: "li", form: nil, attribute: nil, field_name: nil,
enabled: false, input_enabled: true, title:, description:)
@tag = tag
@form = form
@attribute = attribute
@tag = tag
@field_name = field_name
@form_enabled = @form.present? || @field_name.present?
@enabled = enabled
@input_enabled = input_enabled
@title = title