Class: Admin::LabelComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
lib/generators/infold/templates/install/app/components/admin/label_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(form, field, label: nil, required: false) ⇒ LabelComponent

Returns a new instance of LabelComponent.



5
6
7
8
9
10
# File 'lib/generators/infold/templates/install/app/components/admin/label_component.rb', line 5

def initialize(form, field, label: nil, required: false)
  @form = form
  @field = field
  @label = label
  @required = required ? 'required' : nil
end

Instance Method Details

#callObject



12
13
14
# File 'lib/generators/infold/templates/install/app/components/admin/label_component.rb', line 12

def call
  @form.label @field, @label, class: "form-label fw-bold text-muted #{@required}"
end