diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 22336cd2..9654d26b 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -159,7 +159,7 @@ function saveLayoutAll() { var coor = ""; if (gType == "arranged" || gType == "chaotic") { Mconsole.graph.eachNode(function(n) { - coor = coor + n.data.$mappingid + '/' + n.pos.x + '/' + n.pos.y + ','; + coor = coor + n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y + ','; }); coor = coor.slice(0, -1); $('#map_coordinates').val(coor); @@ -170,7 +170,7 @@ function saveLayoutAll() { // this is to update the location coordinate of a single node on a map function saveLayout(id) { var n = Mconsole.graph.getNode(id); - $('#map_coordinates').val(n.data.$mappingid + '/' + n.pos.x + '/' + n.pos.y); + $('#map_coordinates').val(n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y); $('#saveMapLayout').submit(); dragged = 0; $('#saveLayout').attr('value','Saved!'); diff --git a/app/views/topics/create.js.erb b/app/views/topics/create.js.erb index 76d73381..d964d3b1 100644 --- a/app/views/topics/create.js.erb +++ b/app/views/topics/create.js.erb @@ -11,8 +11,6 @@ $('#topic_name').attr('value',''); $('#topic_grabTopic').attr('value','null'); $('#topic_addSynapse').attr('value','false'); - - var newnode = <%= @topic.self_as_json.html_safe %>; var x = <%= @position['x'] %>; var y = <%= @position['y'] %>; @@ -85,6 +83,9 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) { temp.setData('dim', 25, 'end'); temp.setData('onCanvas', false); temp.setData('inCommons', false); + if (gType == "arranged" || gType == "chaotic") { + temp.setData('mappingid', <%= @mapping.id %>); + } temp.setPos(new $jit.Complex(x, y), 'current'); temp.setPos(new $jit.Complex(x, y), 'start'); temp.setPos(new $jit.Complex(x, y), 'end');