diff --git a/data/core.yaml b/data/core.yaml index e79858986..dd002bfa0 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -86,6 +86,7 @@ en: relation: Deleted a relation. multiple: "Deleted {n} objects." incomplete_relation: This feature can't be deleted because it hasn't been fully downloaded. + part_of_relation: This feature can't be deleted because it's part of a larger relation. You must remove it from the relation first. connected_to_hidden: This can't be deleted because it is connected to a hidden feature. add_member: annotation: Added a member to a relation. diff --git a/dist/locales/en.json b/dist/locales/en.json index 55064aa44..6ea44af14 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -110,6 +110,7 @@ "multiple": "Deleted {n} objects." }, "incomplete_relation": "This feature can't be deleted because it hasn't been fully downloaded.", + "part_of_relation": "This feature can't be deleted because it's part of a larger relation. You must remove it from the relation first.", "connected_to_hidden": "This can't be deleted because it is connected to a hidden feature." }, "add_member": { diff --git a/js/id/actions/delete_way.js b/js/id/actions/delete_way.js index c87b31011..19f0d669e 100644 --- a/js/id/actions/delete_way.js +++ b/js/id/actions/delete_way.js @@ -31,8 +31,17 @@ iD.actions.DeleteWay = function(wayId) { return graph.remove(way); }; - action.disabled = function() { - return false; + action.disabled = function(graph) { + var way = graph.entity(wayId); + var reltypes = ['route','boundary']; + var disabled = false; + graph.parentRelations(way) + .forEach(function(parent) { + if (reltypes.indexOf(parent.tags.type)>-1) { + disabled = 'part_of_relation'; + } + }); + return disabled; }; return action;