Class: Nitro::DraggableMorpher

Inherits:
SharedMorpher show all
Defined in:
lib/nitro/helper/javascript/morphing.rb

Overview

Makes a DOM element draggable.

Instance Method Summary collapse

Methods inherited from SharedMorpher

#record_css, #record_js, #require_script_file

Methods inherited from Morpher

#after_end, #after_start, #before_end, #initialize

Constructor Details

This class inherits a constructor from Nitro::Morpher

Instance Method Details

#before_start(buffer) ⇒ Object



119
120
121
122
123
124
125
126
127
# File 'lib/nitro/helper/javascript/morphing.rb', line 119

def before_start(buffer)
  require_script_file :prototype, :effects, :dragdrop
  
  id = @attributes['id'] || @attributes['name']    
  options = @attributes['drag_options'] || ''
  js "new Draggable('#{id}', #{hash_to_js(options)});"

  @attributes.delete(@key)
end