From 670dd5d8749986c75614c79efbfacf456f935fa6 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Thu, 29 Jan 2015 22:23:24 -0500 Subject: [PATCH] added user feedback, and moved the edge actually hiding into the if statement where it should be --- app/assets/javascripts/src/Metamaps.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index 07e9af96..b05d6301 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -2762,6 +2762,8 @@ Metamaps.Control = { topicid: topicid }]); Metamaps.Control.hideNode(nodeid); + } else { + Metamaps.GlobalUI.notifyUser('Only topics you created can be deleted'); } }, removeSelectedNodes: function () { // refers to removing topics permanently from a map @@ -2914,10 +2916,6 @@ Metamaps.Control = { return; } - if (edge.getData("synapses").length - 1 === 0) { - Metamaps.Control.hideEdge(edge); - } - var index = edge.getData("displayIndex") ? edge.getData("displayIndex") : 0; var synapse = edge.getData("synapses")[index]; @@ -2925,6 +2923,10 @@ Metamaps.Control = { var permToDelete = Metamaps.Active.Mapper.id === synapse.get('user_id'); if (permToDelete) { + if (edge.getData("synapses").length - 1 === 0) { + Metamaps.Control.hideEdge(edge); + } + var synapseid = synapse.id; synapse.destroy(); @@ -2938,6 +2940,8 @@ Metamaps.Control = { $(document).trigger(Metamaps.JIT.events.deleteSynapse, [{ synapseid: synapseid }]); + } else { + Metamaps.GlobalUI.notifyUser('Only synapses you created can be deleted'); } }, removeSelectedEdges: function () {