Class: Lapillus::Droppable

Inherits:
UniqueIdentifier show all
Defined in:
lib/lapillus/behaviours.rb

Instance Attribute Summary

Attributes inherited from Component

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

Instance Method Summary collapse

Methods inherited from UniqueIdentifier

#initialize, #value

Methods inherited from Behaviour

#initialize

Methods inherited from Component

#add_behaviour, #behaviour, #has_behaviour?, #has_model?, #has_parent?, #initialize, #parent, #path, #response_page=, #session, #value, #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::UniqueIdentifier

Instance Method Details

#render_to_element(element) ⇒ Object



205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/lapillus/behaviours.rb', line 205

def render_to_element(element)
  javascript = <<EOF
    Droppables.add('#{parent.path}', {
      onDrop: function(element) { 
        new Ajax.Updater('#{parent.path}', '', { 
          method:'get', parameters: { 
            listener:'#{parent.path}',
            component:element.id
          }
        }); return false;
      }
    });
EOF
  super
  element.add_javascript(javascript)
end