From dd8e421cd467ae1795733b919a20547560504f14 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 9 Dec 2012 19:44:50 -0500 Subject: [PATCH] Revert "Revert "fixed bug that wasn't letting you save the layout of a map if you had added new synapses to it."" This reverts commit 31ab10b3387ebc92a214ec24922ae7cafc39f41e. --- app/controllers/synapses_controller.rb | 2 +- app/views/synapses/create.js.erb | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/synapses_controller.rb b/app/controllers/synapses_controller.rb index 08ab27dd..1d0d2225 100644 --- a/app/controllers/synapses_controller.rb +++ b/app/controllers/synapses_controller.rb @@ -89,7 +89,7 @@ class SynapsesController < ApplicationController respond_to do |format| format.html { respond_with(@user, location: user_synapse_url(@user, @synapse)) } - format.js { respond_with(@synapse) } + format.js { respond_with(@synapse, @mapping1, @mapping2) } end end diff --git a/app/views/synapses/create.js.erb b/app/views/synapses/create.js.erb index 05a73133..134b9ab4 100644 --- a/app/views/synapses/create.js.erb +++ b/app/views/synapses/create.js.erb @@ -18,7 +18,7 @@ if (map1 != null) { mymap = map; } - if (mymap == fd || mymap == rg || mymap = map) { + if (mymap == fd || mymap == rg || mymap == map) { temp1 = mymap.graph.getNode(<%= @synapse.item1.id %>); if (temp1 == null) { newnode = <%= @synapse.item1.self_as_json.html_safe %>; @@ -36,6 +36,11 @@ if (map1 != null) { temp.setPos(new $jit.Polar(5.54, 347.6), 'start'); temp.setPos(new $jit.Polar(5.54, 347.6), 'end'); } + <% unless (@mapping1.nil?) %> + temp.setData('xloc',0); + temp.setData('yloc',0); + temp.setData('mappingid', '<%= @mapping1.id %>'); + <% end %> mymap.fx.plotNode(temp, mymap.canvas); temp1 = mymap.graph.getNode(<%= @synapse.item1.id %>); } @@ -56,6 +61,11 @@ if (map1 != null) { temp.setPos(new $jit.Polar(5.54, 347.6), 'start'); temp.setPos(new $jit.Polar(5.54, 347.6), 'end'); } + <% unless (@mapping2.nil?) %> + temp.setData('xloc',0); + temp.setData('yloc',0); + temp.setData('mappingid', '<%= @mapping2.id %>'); + <% end %> mymap.fx.plotNode(temp, mymap.canvas); temp2 = mymap.graph.getNode(<%= @synapse.item2.id %>); }