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?, #initialize, #on_render, #parent, #path, #render_component, #response_page=, #session, #value, #visible?, #webpage

Constructor Details

This class inherits a constructor from Lapillus::Component

Instance Method Details

#render_to_element(element) ⇒ Object



29
30
31
32
33
34
# File 'lib/lapillus/form_components.rb', line 29

def render_to_element(element)
  super
  text = value
  text = '' if text.nil?  # TODO: should this be done here, or is this the responsibility of the model ?
  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



38
39
40
41
# File 'lib/lapillus/form_components.rb', line 38

def value=text
  text = text.string if (text.kind_of?(StringIO))
  super(text)
end