akkounts/app/components/form_elements/fieldset_toggle_component.rb
Râu Cao f3159d30f1
All checks were successful
continuous-integration/drone/push Build is passing
Allow admins to add and remove invitations per account
2024-02-10 11:21:45 +01:00

20 lines
610 B
Ruby

# frozen_string_literal: true
module FormElements
class FieldsetToggleComponent < ViewComponent::Base
def initialize(tag: "li", form: nil, attribute: nil, field_name: nil,
enabled: false, input_enabled: true, title:, description: nil)
@tag = tag
@form = form
@attribute = attribute
@field_name = field_name
@form_enabled = @form.present? || @field_name.present?
@enabled = enabled
@input_enabled = input_enabled
@title = title
@descripton = description
@button_text = @enabled ? "Switch off" : "Switch on"
end
end
end