Class: Lapillus::FormTextComponent

Inherits:
FormComponent show all
Defined in:
lib/lapillus/form_components.rb

Direct Known Subclasses

TextArea, TextField

Instance Attribute Summary

Attributes inherited from Component

#behaviours, #identifier, #model, #property, #visible

Instance Method Summary collapse

Methods inherited from FormComponent

#post, #value

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, options={})
  options[:model] = '' if options[:model].nil? 
  super(id, options)
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