From 060a9824fbacd4f702dd169af3fb5824588e602f Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Fri, 10 Sep 2010 21:15:59 +0200 Subject: [PATCH] Fixed saving positions when your not using Plemp! locally. --- plemp.rb | 5 ++++- public/dragreg.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plemp.rb b/plemp.rb index 477a754..539251c 100644 --- a/plemp.rb +++ b/plemp.rb @@ -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 diff --git a/public/dragreg.js b/public/dragreg.js index 2e6f920..d237ae7 100644 --- a/public/dragreg.js +++ b/public/dragreg.js @@ -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); } }