Class: Lapillus::FormComponent
- Inherits:
-
Component
- Object
- RenderableComponent
- Component
- Lapillus::FormComponent
- Defined in:
- lib/lapillus/form_components.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Component
#behaviours, #identifier, #model, #property, #visible
Instance Method Summary collapse
- #post(values) ⇒ Object
- #render_to_element(element) ⇒ Object
- #value ⇒ Object
- #value=(new_value) ⇒ Object
Methods inherited from Component
#add_behaviour, #behaviour, #has_behaviour?, #has_model?, #has_parent?, #initialize, #parent, #path, #response_page=, #session, #webpage
Methods inherited from RenderableComponent
#initialize, #on_render, #render_behaviours, #render_children, #render_component, #render_container, #visible?
Constructor Details
This class inherits a constructor from Lapillus::Component
Instance Method Details
#post(values) ⇒ Object
5 6 7 |
# File 'lib/lapillus/form_components.rb', line 5 def post(values) self.value=values[path] if values.has_key?(path) end |
#render_to_element(element) ⇒ Object
9 10 11 |
# File 'lib/lapillus/form_components.rb', line 9 def render_to_element(element) element.attributes['name'] = path end |
#value ⇒ Object
13 14 15 16 17 |
# File 'lib/lapillus/form_components.rb', line 13 def value return super if has_model? return parent.model.send(identifier) if parent.has_model? raise "model not set!" end |
#value=(new_value) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/lapillus/form_components.rb', line 19 def value=new_value if property.nil? @model=new_value else model.send(property.to_s+"=", new_value) end end |