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