Class: Lapillus::Droppable
- Inherits:
-
UniqueIdentifier
- Object
- Component
- Behaviour
- AttributeModifier
- UniqueIdentifier
- Lapillus::Droppable
- 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
Methods inherited from Behaviour
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 = " Droppables.add('\#{parent.path}', {\n onDrop: function(element) { \n new Ajax.Updater('\#{parent.path}', '', { \n method:'get', parameters: { \n listener:'\#{parent.path}',\n component:element.id\n }\n }); return false;\n }\n });\n" 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 |