Class: Lapillus::Draggable

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

#value

Methods inherited from Component

#add_behaviour, #behaviour, #has_behaviour?, #has_model?, #has_parent?, #parent, #path, #response_page=, #session, #value, #webpage

Methods inherited from RenderableComponent

#on_render, #render_behaviours, #render_children, #render_component, #render_container, #visible?

Constructor Details

#initialize(options = []) ⇒ Draggable

Returns a new instance of Draggable.



75
76
77
78
79
# File 'lib/lapillus/behaviours.rb', line 75

def initialize(options=[])
  super()
  @extra_options=options.to_a
  @option=Hash.new
end

Instance Method Details

#change=(value) ⇒ Object



117
118
119
# File 'lib/lapillus/behaviours.rb', line 117

def change= value
  @option[:change]= value
end

#constraint=(value) ⇒ Object



97
98
99
# File 'lib/lapillus/behaviours.rb', line 97

def constraint= value
  @option[:constraint]="'#{value}'"
end

#end_effect=(value) ⇒ Object



113
114
115
# File 'lib/lapillus/behaviours.rb', line 113

def end_effect= value
  @option[:endeffect]= value
end

#ghosting=(value) ⇒ Object



101
102
103
# File 'lib/lapillus/behaviours.rb', line 101

def ghosting= value
  @option[:ghosting]= value ? "true" : "false"
end

#handle=(handleclass) ⇒ Object



81
82
83
# File 'lib/lapillus/behaviours.rb', line 81

def handle= handleclass
  @option[:handle] = "'#{handleclass}'"
end

#render_to_element(element) ⇒ Object



121
122
123
124
125
126
127
128
# File 'lib/lapillus/behaviours.rb', line 121

def render_to_element(element)
  super
  #add_javascript_to_header(element.root_node,"/editiemachine/context/javascript/prototype.js")
  #add_javascript_to_header(element.root_node,"/editiemachine/context/javascript/scriptaculous.js")
  
  options=@option.to_a.collect{|o| "#{o[0]}:#{o[1]}" }.sort.concat(@extra_options).join(",")
  element.add_javascript("new Draggable('#{parent.path}', {#{options}});")
end

#revert=(value) ⇒ Object



85
86
87
# File 'lib/lapillus/behaviours.rb', line 85

def revert= value
  @option[:revert]= value ? "true" : "false"
end

#revert_effect=(value) ⇒ Object



109
110
111
# File 'lib/lapillus/behaviours.rb', line 109

def revert_effect= value
  @option[:reverteffect]= value
end

#snap=(value) ⇒ Object



89
90
91
# File 'lib/lapillus/behaviours.rb', line 89

def snap= value
  @option[:snap]= value ? "true" : "false"
end

#start_effect=(value) ⇒ Object



105
106
107
# File 'lib/lapillus/behaviours.rb', line 105

def start_effect= value
  @option[:starteffect]= value
end

#zindex=(value) ⇒ Object



93
94
95
# File 'lib/lapillus/behaviours.rb', line 93

def zindex= value
  @option[:zindex]= value
end