Class: Trestle::Form::Fields::FormControl
- Inherits:
-
Trestle::Form::Field
- Object
- Trestle::Form::Field
- Trestle::Form::Fields::FormControl
- Defined in:
- lib/trestle/form/fields/form_control.rb
Direct Known Subclasses
ColorField, DateField, DatetimeField, EmailField, MonthField, NumberField, PasswordField, SearchField, TelephoneField, TextArea, TextField, TimeField, UrlField, WeekField
Instance Attribute Summary
Attributes inherited from Trestle::Form::Field
#block, #builder, #name, #options, #template
Instance Method Summary collapse
Methods inherited from Trestle::Form::Field
#errors, #field, #form_group, #initialize
Constructor Details
This class inherits a constructor from Trestle::Form::Field
Instance Method Details
#defaults ⇒ Object
25 26 27 |
# File 'lib/trestle/form/fields/form_control.rb', line 25 def defaults super.merge(class: ["form-control"]) end |
#extract_options! ⇒ Object
29 30 31 32 33 34 |
# File 'lib/trestle/form/fields/form_control.rb', line 29 def super @prepend = .delete(:prepend) @append = .delete(:append) end |
#input_group ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/trestle/form/fields/form_control.rb', line 13 def input_group if @prepend || @append content_tag(:div, class: "input-group") do concat content_tag(:span, @prepend, class: "input-group-addon") if @prepend concat yield concat content_tag(:span, @append, class: "input-group-addon") if @append end else yield end end |
#render ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/trestle/form/fields/form_control.rb', line 5 def render form_group do input_group do field end end end |