Class: Shoehorn::Components::Form::InputField
- Inherits:
-
Shoehorn::Components::Form
- Object
- Base
- Shoehorn::Components::Form
- Shoehorn::Components::Form::InputField
- Defined in:
- lib/shoehorn/components/form/input_field.rb
Instance Attribute Summary collapse
-
#input_html ⇒ Object
Returns the value of attribute input_html.
-
#label_html ⇒ Object
Returns the value of attribute label_html.
Attributes inherited from Base
#default_options, #options, #output_buffer
Instance Method Summary collapse
-
#initialize(object_name, method, input_html, options = {}) ⇒ InputField
constructor
A new instance of InputField.
- #to_s ⇒ Object
Constructor Details
#initialize(object_name, method, input_html, options = {}) ⇒ InputField
Returns a new instance of InputField.
5 6 7 8 9 |
# File 'lib/shoehorn/components/form/input_field.rb', line 5 def initialize(object_name, method, input_html, = {}) super() @input_html = input_html @label_html = Label.new(object_name, method, ) if [:label] || [:label_text] end |
Instance Attribute Details
#input_html ⇒ Object
Returns the value of attribute input_html.
3 4 5 |
# File 'lib/shoehorn/components/form/input_field.rb', line 3 def input_html @input_html end |
#label_html ⇒ Object
Returns the value of attribute label_html.
3 4 5 |
# File 'lib/shoehorn/components/form/input_field.rb', line 3 def label_html @label_html end |
Instance Method Details
#to_s ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/shoehorn/components/form/input_field.rb', line 11 def to_s output_buffer << content_tag(:div, :class => 'control-group') do html = '' html << label_html.to_s html << content_tag(:div, :class => 'controls') do build_input_wrapper << build_help_text end html.html_safe end super end |