diff --git a/app/views/synapses/create.js.erb b/app/views/synapses/create.js.erb deleted file mode 100644 index d2c8dcf8..00000000 --- a/app/views/synapses/create.js.erb +++ /dev/null @@ -1,55 +0,0 @@ -/* - * @file - * Javascript called when you create a new synapse. - */ -$('#new_synapse').fadeOut('fast'); -$('#synapse_desc').typeahead('setQuery',''); -$('#synapse_topic1id').attr('value','0'); -$('#synapse_topic2id').attr('value','0'); -$('#synapse_grabSynapse').attr('value','null'); -// reset the draw synapse positions to false -MetamapsModel.synapseStartCoord = false; -MetamapsModel.synapseEndCoord = false; - -var temp1, temp2, temp; - -if ( Mconsole != null) { - temp1 = Mconsole.graph.getNode(<%= @synapse.topic1.id %>); - temp2 = Mconsole.graph.getNode(<%= @synapse.topic2.id %>); - temp2.setData('dim', 25, 'current'); - Mconsole.graph.addAdjacence(temp1, temp2, {}); - temp = Mconsole.graph.getAdjacence(temp1.id, temp2.id); - temp.setDataset('start', { - lineWidth: 0.4, - alpha: 0.1 - }); - temp.setDataset('end', { - lineWidth: 2, - alpha: 1 - }); - var d = new Array(<%= @synapse.node1_id.to_s() %>, <%= @synapse.node2_id.to_s() %>); - temp.setDataset('current', { - desc: '<%= @synapse.desc %>', - showDesc: true, //will be changed by selectEdge - category: '<%= @synapse.category %>', - id: '<%= @synapse.id %>', - userid: <%= @synapse.user.id %>, - username: '<%= @synapse.user.name %>', - permission: '<%= @synapse.permission %>' - }); - temp.data.$direction = d; - Mconsole.fx.animate({ - modes: ['edge-property:lineWidth:alpha'], - duration: 100, - onComplete: function() { - setTimeout(function (){ - temp.setData('showDesc', false); - Mconsole.plot(); - }, 3000); - } - }); -} -else { - json = <%= @synapse.selfplusnodes_as_json.html_safe %> - initialize("chaotic"); -} diff --git a/app/views/synapses/destroy.js.erb b/app/views/synapses/destroy.js.erb deleted file mode 100644 index c9d0a6b9..00000000 --- a/app/views/synapses/destroy.js.erb +++ /dev/null @@ -1,4 +0,0 @@ -/* - * @file - * Javascript called when you destroy a node - */ diff --git a/app/views/synapses/removefrommap.js.erb b/app/views/synapses/removefrommap.js.erb deleted file mode 100644 index 61bfd185..00000000 --- a/app/views/synapses/removefrommap.js.erb +++ /dev/null @@ -1,5 +0,0 @@ -/* - * @file - * Javascript executed when a synapse is removed from a map - * TODO: Is this file even used? - */ diff --git a/app/views/synapses/update.js.erb b/app/views/synapses/update.js.erb deleted file mode 100644 index b8f9dd59..00000000 --- a/app/views/synapses/update.js.erb +++ /dev/null @@ -1,4 +0,0 @@ -/* - * @file - * Javascript called when you update a synapse - */ diff --git a/app/views/topics/create.js.erb b/app/views/topics/create.js.erb deleted file mode 100644 index 77defa96..00000000 --- a/app/views/topics/create.js.erb +++ /dev/null @@ -1,115 +0,0 @@ -/* - * @file - * This javascript is returned and executed when you create a new node. - */ -$('#new_topic').fadeOut('fast'); -$('#topic_name').typeahead('setQuery',''); -$('#topic_grabTopic').attr('value','null'); -$('#topic_addSynapse').attr('value','false'); - -var newnode = <%= @topic.self_as_json.html_safe %>; -var x = <%= @position['x'] %>; -var y = <%= @position['y'] %>; - - -if (!$.isEmptyObject(Mconsole.graph.nodes)) { - Mconsole.graph.addNode(newnode); - - // set the animation for everything back to normal - Mconsole.graph.eachNode( function (n) { - n.setData('dim', 25, 'start'); - n.setData('dim', 25, 'end'); - }); - var temp = Mconsole.graph.getNode('<%= @topic.id %>'); - temp.setData('dim', 1, 'start'); - temp.setData('dim', 40, 'end'); - temp.setData('whiteCircle', false); - temp.setData('greenCircle', false); - - if (gType == "centered") { - var tempPos = new $jit.Complex(x, y); - tempPos = tempPos.toPolar(); - temp.setPos(tempPos, 'current'); - temp.setPos(tempPos, 'start'); - temp.setPos(tempPos, 'end'); - temp._depth = tempNode._depth + 1; - } - else if (gType == "arranged" || gType == "chaotic") { - temp.setData('xloc',0); - temp.setData('yloc',0); - <% if not @mapping.nil? %> - temp.setData('mappingid', <%= @mapping.id %>); - <% elsif @mapping.nil? %> - temp.setData('mappingid', null); - <% end %> - temp.setPos(new $jit.Complex(x, y), 'current'); - temp.setPos(new $jit.Complex(x, y), 'start'); - temp.setPos(new $jit.Complex(x, y), 'end'); - } - - if ( '<%= @synapse %>' == "true" ) { - $('#synapse_topic1id').val(tempNode.id); - $('#synapse_topic2id').val(temp.id); - $('#synapse_desc').val(""); - $('#new_synapse').fadeIn('fast'); - $('#synapse_desc').focus(); - Mconsole.fx.animate({ - modes: ['node-property:dim'], - duration: 500, - onComplete: function() { - setTimeout(function (){ - temp.setData('dim', 25, 'current'); - Mconsole.plot(); - }, 3000); - Mconsole.fx.plotNode(tempNode, Mconsole.canvas); - Mconsole.fx.plotNode(temp, Mconsole.canvas); - tempNode = null; - tempNode2 = null; - tempInit = false; - } - }); - } else if ( '<%= @synapse %>' == "false" ) { - Mconsole.fx.plotNode(temp, Mconsole.canvas); - Mconsole.fx.animate({ - modes: ['node-property:dim'], - duration: 500, - onComplete: function() { - setTimeout(function (){ - temp.setData('dim', 25, 'current'); - Mconsole.plot(); - }, 3000); - } - }); - - } - -} else { - json = newnode; - Mconsole.loadJSON(json); - var temp = Mconsole.graph.getNode('<%= @topic.id %>'); - temp.setData('dim', 1, 'start'); - temp.setData('dim', 25, 'end'); - temp.setData('whiteCircle', false); - temp.setData('greenCircle', false); - if (gType == "arranged" || gType == "chaotic") { - <% if not @mapping.nil? %> - temp.setData('mappingid', <%= @mapping.id %>); - <% elsif @mapping.nil? %> - temp.setData('mappingid', null); - <% end %> - } - temp.setPos(new $jit.Complex(x, y), 'current'); - temp.setPos(new $jit.Complex(x, y), 'start'); - temp.setPos(new $jit.Complex(x, y), 'end'); - Mconsole.fx.plotNode(temp, Mconsole.canvas); - Mconsole.fx.animate({ - modes: ['node-property:dim'], - duration: 500, - onComplete: function() { - setTimeout(function (){ - temp.setData('dim', 25, 'current'); - Mconsole.plot(); - }, 3000); - } - }); -} diff --git a/app/views/topics/destroy.js.erb b/app/views/topics/destroy.js.erb deleted file mode 100644 index 5c133d12..00000000 --- a/app/views/topics/destroy.js.erb +++ /dev/null @@ -1,33 +0,0 @@ -/* - * @file - * The javascript returned when destroy is called in the topic controller - * This happens when a DELETE is sent to /topics/:id - */ - -if (Mconsole != null) { - - var node = Mconsole.graph.getNode(<%= @topic.id %>); - - if (node.id == Mconsole.root) { - Mconsole.graph.eachNode(function (n) { - if (n.id != node.id) Mconsole.root = n.id; - }); - } - - 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 %>); - delete Mconsole.labels.labels['<%= @topic.id %>'] - -} -else { - $('#<%= dom_id(@topic) %>').fadeOut('slow'); -} diff --git a/app/views/topics/removefrommap.js.erb b/app/views/topics/removefrommap.js.erb deleted file mode 100644 index a38fbf9e..00000000 --- a/app/views/topics/removefrommap.js.erb +++ /dev/null @@ -1,27 +0,0 @@ -/* - * @file - * This code removes a mapping from a topic on to a map, which removes the - * topic from that map. - * TODO: is this code still used? - * TODO: What URL accesses this code? - */ - - -if (Mconsole != null) { - var node = Mconsole.graph.getNode(<%= @mapping.topic_id %>); - if (node.id == Mconsole.root) { - Mconsole.graph.eachNode(function (n) { - if (n.id != node.id) Mconsole.root = n.id; - }); - } - 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(<%= @mapping.topic_id %>); -}