2012-10-21 13:19:59 -04:00
|
|
|
$('#new_item').fadeOut('fast');
|
2012-12-16 15:00:43 -05:00
|
|
|
$('#item_name').data().autocomplete.term = null;
|
|
|
|
$('.ui-autocomplete').children().remove();
|
|
|
|
$('.ui-autocomplete').css('display','none');
|
|
|
|
$('#item_name').attr('value','');
|
2012-10-21 14:32:17 -04:00
|
|
|
|
2012-12-15 02:39:14 -05:00
|
|
|
if(viewMode == "graph") {
|
|
|
|
var newnode = <%= @item.self_as_json.html_safe %>;
|
2012-12-16 01:12:41 -05:00
|
|
|
var x = <%= @position['x'] %>;
|
|
|
|
var y = <%= @position['y'] %>;
|
|
|
|
|
2012-10-21 16:08:41 -04:00
|
|
|
|
2012-12-15 02:39:14 -05:00
|
|
|
if (Mconsole != null) {
|
|
|
|
Mconsole.graph.addNode(newnode);
|
2012-12-16 15:00:43 -05:00
|
|
|
|
|
|
|
// set the animation for everything back to normal
|
|
|
|
Mconsole.graph.eachNode( function (n) {
|
|
|
|
n.setData('dim', 25, 'start');
|
|
|
|
n.setData('dim', 25, 'end');
|
|
|
|
});
|
2012-12-15 02:39:14 -05:00
|
|
|
var temp = Mconsole.graph.getNode('<%= @item.id %>');
|
2012-10-24 02:47:08 -04:00
|
|
|
temp.setData('dim', 1, 'start');
|
|
|
|
temp.setData('dim', 40, 'end');
|
2012-12-14 13:31:39 -05:00
|
|
|
|
|
|
|
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');
|
|
|
|
}
|
2012-12-15 02:39:14 -05:00
|
|
|
else if (gType == "arranged" || gType == "chaotic") {
|
2012-12-14 13:31:39 -05:00
|
|
|
temp.setData('xloc',0);
|
|
|
|
temp.setData('yloc',0);
|
|
|
|
temp.setData('mappingid', '<%= @mapping.id %>');
|
2012-12-16 01:12:41 -05:00
|
|
|
temp.setPos(new $jit.Complex(x, y), 'current');
|
|
|
|
temp.setPos(new $jit.Complex(x, y), 'start');
|
2012-12-20 19:24:27 -05:00
|
|
|
temp.setPos(new $jit.Complex(x, y), 'end');s
|
2012-12-14 13:31:39 -05:00
|
|
|
}
|
|
|
|
|
2012-12-15 02:39:14 -05:00
|
|
|
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
|
|
|
Mconsole.fx.animate({
|
2012-12-01 18:05:17 -05:00
|
|
|
modes: ['node-property:dim'],
|
|
|
|
duration: 400
|
|
|
|
});
|
|
|
|
}
|
2012-10-26 06:04:52 -04:00
|
|
|
else {
|
|
|
|
json = newnode;
|
2012-12-14 13:31:39 -05:00
|
|
|
initialize("chaotic");
|
2012-10-26 06:04:52 -04:00
|
|
|
}
|
2012-10-21 14:32:17 -04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#cards').prepend('<%= escape_javascript(render(@item)) %>');
|
2012-12-15 02:39:14 -05:00
|
|
|
$(".scroll").mCustomScrollbar();
|
2012-12-16 15:00:43 -05:00
|
|
|
}
|