Fixed saving positions when your not using Plemp! locally.
This commit is contained in:
parent
e7b4425936
commit
060a9824fb
5
plemp.rb
5
plemp.rb
|
@ -40,7 +40,7 @@ module Plemp::Controllers
|
||||||
class SaveposXXX
|
class SaveposXXX
|
||||||
def post(id, top, left)
|
def post(id, top, left)
|
||||||
[top, left].each { |pos| pos.gsub!(/px$/, '') }
|
[top, left].each { |pos| pos.gsub!(/px$/, '') }
|
||||||
$stderr.puts("Got: id: #{id} -> top: #{top}, left: #{left}") if $DEBUG
|
$stderr.puts("Got: id: #{id} -> top: #{top}, left: #{left}")
|
||||||
Positions[id] = [top, left]
|
Positions[id] = [top, left]
|
||||||
$stderr.puts Positions.inspect if $DEBUG
|
$stderr.puts Positions.inspect if $DEBUG
|
||||||
""
|
""
|
||||||
|
@ -71,6 +71,9 @@ module Plemp::Views
|
||||||
['prototype', 'scriptaculous', 'dragreg'].each do |js|
|
['prototype', 'scriptaculous', 'dragreg'].each do |js|
|
||||||
script :src => R(StaticXX, "public", "#{js}.js"),
|
script :src => R(StaticXX, "public", "#{js}.js"),
|
||||||
:type => "text/javascript"
|
:type => "text/javascript"
|
||||||
|
script :type => "text/javascript" do
|
||||||
|
"BaseUrl = \"#{URL()}\";"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
body do
|
body do
|
||||||
|
|
|
@ -7,7 +7,7 @@ DragRegObserver.prototype = {
|
||||||
onEnd: function (eventName, draggable, event) {
|
onEnd: function (eventName, draggable, event) {
|
||||||
if (Draggables.activeDraggable.element == this.element) {
|
if (Draggables.activeDraggable.element == this.element) {
|
||||||
elem = draggable.element;
|
elem = draggable.element;
|
||||||
new Ajax.Request('http://localhost:3301/savepos/' + elem.id +
|
new Ajax.Request(BaseUrl + 'savepos/' + elem.id +
|
||||||
'/' + elem.style.top + '/' + elem.style.left);
|
'/' + elem.style.top + '/' + elem.style.left);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue