metamaps--metamaps/app/views/items/create.js.erb

36 lines
884 B
Text
Raw Normal View History

$('#new_item').fadeOut('fast');
2012-10-21 17:46:27 +00:00
$('#new_item')[0].reset()
// if there's a map, add the node to that, if its in card view add card
obj = document.getElementById('container');
if (obj != null) {
var newnode = <%= @item.self_as_json.html_safe %>;
if (fd != null) {
fd.graph.addNode(newnode);
var temp = fd.graph.getNode('<%= @item.id %>');
temp.setData('dim', 1, 'start');
temp.setData('dim', 40, 'end');
fd.fx.animate({
2012-10-21 17:46:27 +00:00
modes: ['node-property:dim'],
duration: 400
});
}
else if (rg != null) {
rg.graph.addNode(newnode);
var temp = rggraph.getNode('<%= @item.id %>');
temp.setData('dim', 1, 'start');
temp.setData('dim', 40, 'end');
rg.fx.animate({
modes: ['node-property:dim'],
duration: 400
});
}
}
else {
$('#cards').prepend('<%= escape_javascript(render(@item)) %>');
}