Class: Lapillus::PostWithAjax
- Inherits:
-
AttributeModifier
- Object
- RenderableComponent
- Component
- Behaviour
- AttributeModifier
- Lapillus::PostWithAjax
- Defined in:
- lib/lapillus/behaviours.rb
Instance Attribute Summary collapse
-
#component_to_refresh ⇒ Object
Returns the value of attribute component_to_refresh.
Attributes inherited from Component
#behaviours, #identifier, #model, #property, #visible
Instance Method Summary collapse
-
#initialize(component_to_refresh = nil) ⇒ PostWithAjax
constructor
A new instance of PostWithAjax.
- #value ⇒ Object
Methods inherited from AttributeModifier
Methods inherited from Component
#add_behaviour, #behaviour, #has_behaviour?, #has_model?, #has_parent?, #parent, #path, #response_page=, #session, #webpage
Methods inherited from RenderableComponent
#on_render, #render_behaviours, #render_children, #render_component, #render_container, #render_to_element, #visible?
Constructor Details
#initialize(component_to_refresh = nil) ⇒ PostWithAjax
Returns a new instance of PostWithAjax.
157 158 159 160 161 |
# File 'lib/lapillus/behaviours.rb', line 157 def initialize(component_to_refresh=nil) super(:onsubmit) @component_to_refresh = component_to_refresh component_to_refresh.add_behaviour(UniqueIdentifier.new) if !component_to_refresh.nil? end |
Instance Attribute Details
#component_to_refresh ⇒ Object
Returns the value of attribute component_to_refresh.
156 157 158 |
# File 'lib/lapillus/behaviours.rb', line 156 def component_to_refresh @component_to_refresh end |
Instance Method Details
#value ⇒ Object
163 164 165 166 |
# File 'lib/lapillus/behaviours.rb', line 163 def value updateScript = "new Ajax.Updater('#{component_to_refresh.path}', '', { evalScripts: true, method: 'post', parameters:Form.serialize(this)}); return false;" return updateScript end |