Class: Superform::Rails::Components::Label
- Inherits:
-
Base
- Object
- Base
- Superform::Rails::Components::Label
show all
- Defined in:
- lib/superform/rails/components/label.rb
Instance Attribute Summary
Attributes inherited from Base
#dom, #field
Instance Method Summary
collapse
Methods inherited from Base
#focus, #initialize
Instance Method Details
#field_attributes ⇒ Object
10
11
12
|
# File 'lib/superform/rails/components/label.rb', line 10
def field_attributes
{ for: dom.id }
end
|
#label_text ⇒ Object
14
15
16
|
# File 'lib/superform/rails/components/label.rb', line 14
def label_text
field.key.to_s.titleize
end
|
#view_template(&content) ⇒ Object
5
6
7
8
|
# File 'lib/superform/rails/components/label.rb', line 5
def view_template(&content)
content ||= Proc.new { label_text }
label(**attributes, &content)
end
|