fixed bug that wasn't letting you save the layout of a map if you had added new synapses to it.

This commit is contained in:
Connor Turland 2012-12-09 19:06:36 -05:00
parent 4ab7fe76ca
commit 698690effd
2 changed files with 12 additions and 2 deletions

View file

@ -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

View file

@ -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 %>);
}