can now remove synapses from maps with R key, although you can't really tell if you reload the page

This commit is contained in:
Devin Howard 2013-01-05 23:37:24 -05:00
parent d364019adb
commit b3ccbbbd74
3 changed files with 22 additions and 1 deletions

View file

@ -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() {

View file

@ -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

View file