Don't delete ways from route/boundary relations

This commit is contained in:
Richard Fairhurst
2015-02-12 12:00:28 +00:00
committed by John Firebaugh
parent 5561ebdb14
commit 0953475f04
3 changed files with 13 additions and 2 deletions

View File

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

View File

@@ -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": {

View File

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