diff --git a/app/assets/javascripts/Jit/graphsettings.js b/app/assets/javascripts/Jit/graphsettings.js index 0d15006a..67b44b26 100644 --- a/app/assets/javascripts/Jit/graphsettings.js +++ b/app/assets/javascripts/Jit/graphsettings.js @@ -871,7 +871,19 @@ function hideEdge(edge) { } function removeSelectedEdges() { - alert ("remove"); + for (var i = 0; i < selectedEdges.length; i += 1) { + if (mapid != null) { + var edge = selectedEdges[i]; + var id = edge.getData("id"); + //delete mapping of id mapid + $.ajax({ + type: "POST", + url: "/mappings/" + mapid + "/" + id + "/removefrommap", + }); + } + hideEdge(edge); + } + selectedEdges = new Array(); } function deleteSelectedEdges() { diff --git a/app/controllers/synapses_controller.rb b/app/controllers/synapses_controller.rb index 21f5e757..3662deaa 100644 --- a/app/controllers/synapses_controller.rb +++ b/app/controllers/synapses_controller.rb @@ -116,6 +116,15 @@ class SynapsesController < ApplicationController end end + # POST mappings/:map_id/:synapse_id/removefrommap + def removefrommap + @mapping = Mapping.find_by_synapse_id_and_map_id(params[:synapse_id],params[:map_id]) + @mapping.delete + + respond_to do |format| + format.js + end + end # DELETE synapses/:id def destroy diff --git a/app/views/synapses/removefrommap.js.erb b/app/views/synapses/removefrommap.js.erb new file mode 100644 index 00000000..e69de29b