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

Constructor Details

This class inherits a constructor from Lapillus::UniqueIdentifier

Instance Method Details

#render_to_element(element) ⇒ Object



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/lapillus/behaviours.rb', line 183

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
  script= REXML::Element.new('script')
  script.add_attributes({'type'=>'text/javascript', 'language'=>'javascript'})
  text=REXML::Text.new("\n// <![CDATA[\n#{javascript}\n// ]]>\n")
  def text.to_s
    @normalized=@string
  end
  script.add_text(text)
  element.add_element(script)
end