Fixed saving positions when your not using Plemp! locally.

This commit is contained in:
Paul van Tilburg 2010-09-10 21:15:59 +02:00
parent e7b4425936
commit 060a9824fb
2 changed files with 5 additions and 2 deletions

View File

@ -40,7 +40,7 @@ module Plemp::Controllers
class SaveposXXX
def post(id, top, left)
[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]
$stderr.puts Positions.inspect if $DEBUG
""
@ -71,6 +71,9 @@ module Plemp::Views
['prototype', 'scriptaculous', 'dragreg'].each do |js|
script :src => R(StaticXX, "public", "#{js}.js"),
:type => "text/javascript"
script :type => "text/javascript" do
"BaseUrl = \"#{URL()}\";"
end
end
end
body do

View File

@ -7,7 +7,7 @@ DragRegObserver.prototype = {
onEnd: function (eventName, draggable, event) {
if (Draggables.activeDraggable.element == this.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);
}
}