47 lines
No EOL
1.5 KiB
Text
47 lines
No EOL
1.5 KiB
Text
$('#new_item').fadeOut('fast');
|
|
$('#new_item')[0].reset();
|
|
|
|
if(viewMode == "graph") {
|
|
var newnode = <%= @item.self_as_json.html_safe %>;
|
|
|
|
|
|
if (Mconsole != null) {
|
|
Mconsole.graph.addNode(newnode);
|
|
var temp = Mconsole.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" || gType == "chaotic") {
|
|
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');
|
|
}
|
|
|
|
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
|
Mconsole.fx.animate({
|
|
modes: ['node-property:dim'],
|
|
duration: 400
|
|
});
|
|
}
|
|
else {
|
|
json = newnode;
|
|
initialize("chaotic");
|
|
}
|
|
// add the new node to the synapse select lists
|
|
$("#node1_id").prepend("<option value='<%= @item.id %>'><%= @item.name %></option>");
|
|
$("#node2_id").prepend("<option value='<%= @item.id %>'><%= @item.name %></option>");
|
|
|
|
}
|
|
else {
|
|
alert('wrong!');
|
|
$('#cards').prepend('<%= escape_javascript(render(@item)) %>');
|
|
$(".scroll").mCustomScrollbar();
|
|
} |