$('#new_item').fadeOut('fast'); $('#new_item')[0].reset() // if there's a map, add the node to that, if its in card view add card map2 = document.getElementById('container'); if (map2 != null) { var newnode = <%= @item.self_as_json.html_safe %>; if (console != null) { var temp = fd.graph.getNode('<%= @item.id %>'); temp.setData('dim', 1, 'start'); temp.setData('dim', 40, 'end'); if (gType == "centered") { temp.setPos(new $jit.Polar(5.54, 347.6), 'current'); temp.setPos(new $jit.Polar(5.54, 347.6), 'start'); temp.setPos(new $jit.Polar(5.54, 347.6), 'end'); } else if (gType == "arranged") { temp.setData('xloc',0); temp.setData('yloc',0); temp.setData('mappingid', '<%= @mapping.id %>'); temp.setPos(new $jit.Complex(0, 0), 'current'); temp.setPos(new $jit.Complex(0, 0), 'start'); temp.setPos(new $jit.Complex(0, 0), 'end'); } else if (gType == "chaotic") { <% unless (@mapping.nil?) %> temp.setData('xloc',0); temp.setData('yloc',0); temp.setData('mappingid', '<%= @mapping.id %>'); <% end %> temp.setPos(new $jit.Complex(0, 0), 'current'); temp.setPos(new $jit.Complex(0, 0), 'start'); temp.setPos(new $jit.Complex(0, 0), 'end'); } console.fx.plotNode(temp, console.canvas); console.fx.animate({ modes: ['node-property:dim'], duration: 400 }); } else { json = newnode; initialize("chaotic"); } console.log(temp); // add the new node to the synapse select lists $("#node1_id").prepend(""); $("#node2_id").prepend(""); } else { $('#cards').prepend('<%= escape_javascript(render(@item)) %>'); $(".scroll").mCustomScrollbar(); }