2013-01-11 23:49:59 +00:00
|
|
|
/*
|
|
|
|
* @file
|
|
|
|
* The javascript returned when destroy is called in the topic controller
|
|
|
|
* This happens when a DELETE is sent to /topics/:id
|
|
|
|
*/
|
|
|
|
|
2013-01-05 02:39:16 +00:00
|
|
|
if (Mconsole != null) {
|
2013-01-25 05:47:32 +00:00
|
|
|
|
2013-01-05 02:39:16 +00:00
|
|
|
var node = Mconsole.graph.getNode(<%= @topic.id %>);
|
2013-01-25 05:47:32 +00:00
|
|
|
|
|
|
|
if (node.id == Mconsole.root) {
|
|
|
|
Mconsole.graph.eachNode(function (n) {
|
|
|
|
if (n.id != node.id) Mconsole.root = n.id;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2013-01-05 02:39:16 +00:00
|
|
|
node.setData('alpha', 0, 'end');
|
|
|
|
node.eachAdjacency(function(adj) {
|
|
|
|
adj.setData('alpha', 0, 'end');
|
|
|
|
});
|
|
|
|
Mconsole.fx.animate({
|
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: 1000
|
|
|
|
});
|
|
|
|
Mconsole.graph.removeNode(<%= @topic.id %>);
|
|
|
|
Mconsole.labels.disposeLabel(<%= @topic.id %>);
|
2013-04-26 04:07:29 +00:00
|
|
|
delete Mconsole.labels.labels['<%= @topic.id %>']
|
|
|
|
|
2013-01-05 02:39:16 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#<%= dom_id(@topic) %>').fadeOut('slow');
|
2013-01-11 23:49:59 +00:00
|
|
|
}
|