Class: Admin::LabelComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Admin::LabelComponent
- Defined in:
- lib/generators/infold/templates/install/app/components/admin/label_component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(form, field, label: nil, required: false) ⇒ LabelComponent
constructor
A new instance of LabelComponent.
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
#call ⇒ Object
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 |