Class: Lapillus::FormTextComponent
- Inherits:
-
FormComponent
- Object
- RenderableComponent
- Component
- FormComponent
- Lapillus::FormTextComponent
- Defined in:
- lib/lapillus/form_components.rb
Instance Attribute Summary
Attributes inherited from Component
#behaviours, #identifier, #model, #property, #visible
Instance Method Summary collapse
-
#initialize(id, options = {}) ⇒ FormTextComponent
constructor
A new instance of FormTextComponent.
- #render_to_element(element) ⇒ Object
-
#value=(text) ⇒ Object
TODO: current form test are not real life enough TODO: use stringio in test instead of string.
Methods inherited from FormComponent
Methods inherited from Component
#add_behaviour, #behaviour, #has_behaviour?, #has_model?, #has_parent?, #parent, #path, #response_page=, #session, #value, #webpage
Methods inherited from RenderableComponent
#on_render, #render_behaviours, #render_children, #render_component, #render_container, #visible?
Constructor Details
#initialize(id, options = {}) ⇒ FormTextComponent
Returns a new instance of FormTextComponent.
29 30 31 32 |
# File 'lib/lapillus/form_components.rb', line 29 def initialize(id, ={}) [:model] = '' if [:model].nil? super(id, ) end |
Instance Method Details
#render_to_element(element) ⇒ Object
34 35 36 37 38 |
# File 'lib/lapillus/form_components.rb', line 34 def render_to_element(element) super text = value render_text(element, text) end |
#value=(text) ⇒ Object
TODO: current form test are not real life enough TODO: use stringio in test instead of string
42 43 44 45 |
# File 'lib/lapillus/form_components.rb', line 42 def value=text text = text.string if (text.kind_of?(StringIO)) super(text) end |