Merge branch 'master' of github.com:openstreetmap/iD

This commit is contained in:
Bryan Housel
2014-06-26 16:50:54 -04:00
8 changed files with 80 additions and 8 deletions
+3
View File
@@ -1748,6 +1748,9 @@ en:
shop/supermarket:
name: Supermarket
terms: "<translate with synonyms or related terms for 'Supermarket', separated by commas>"
shop/tailor:
name: Tailor
terms: "<translate with synonyms or related terms for 'Tailor', separated by commas>"
shop/toys:
name: Toy Store
terms: "<translate with synonyms or related terms for 'Toy Store', separated by commas>"
+23 -1
View File
@@ -3351,7 +3351,8 @@
"address",
"operator",
"opening_hours"
]
],
"searchable": false
},
"craft/tiler": {
"name": "Tiler",
@@ -7590,6 +7591,27 @@
},
"name": "Supermarket"
},
"shop/tailor": {
"name": "Tailor",
"geometry": [
"point",
"area"
],
"terms": [
"tailor",
"clothes"
],
"tags": {
"shop": "tailor"
},
"icon": "clothing-store",
"fields": [
"building_area",
"address",
"operator",
"opening_hours"
]
},
"shop/toys": {
"icon": "shop",
"fields": [
+2 -1
View File
@@ -17,5 +17,6 @@
"address",
"operator",
"opening_hours"
]
],
"searchable": false
}
+21
View File
@@ -0,0 +1,21 @@
{
"name": "Tailor",
"geometry": [
"point",
"area"
],
"terms": [
"tailor",
"clothes"
],
"tags": {
"shop": "tailor"
},
"icon": "clothing-store",
"fields": [
"building_area",
"address",
"operator",
"opening_hours"
]
}
+4
View File
@@ -2783,6 +2783,10 @@
"name": "Supermarket",
"terms": "bazaar,boutique,chain,co-op,cut-rate store,discount store,five-and-dime,flea market,galleria,grocery store,mall,mart,outlet,outlet store,shop,shopping center,shopping centre,shopping plaza,stand,store,supermarket,thrift shop"
},
"shop/tailor": {
"name": "Tailor",
"terms": "tailor,clothes"
},
"shop/toys": {
"name": "Toy Store",
"terms": ""
+9 -1
View File
@@ -1,5 +1,13 @@
iD.actions.DeleteMember = function(relationId, memberIndex) {
return function(graph) {
return graph.replace(graph.entity(relationId).removeMember(memberIndex));
var relation = graph.entity(relationId)
.removeMember(memberIndex);
graph = graph.replace(relation);
if (relation.isDegenerate())
graph = iD.actions.DeleteRelation(relation.id)(graph);
return graph;
};
};
+4
View File
@@ -17,6 +17,10 @@ iD.ui.RawMemberEditor = function(context) {
context.perform(
iD.actions.DeleteMember(d.relation.id, d.index),
t('operations.delete_member.annotation'));
if (!context.hasEntity(d.relation.id)) {
context.enter(iD.modes.Browse(context));
}
}
function rawMemberEditor(selection) {
+14 -5
View File
@@ -1,9 +1,18 @@
describe("iD.actions.DeleteMember", function () {
it("removes the member at the specified index", function () {
var node = iD.Node(),
relation = iD.Relation({members: [{id: node.id}]}),
action = iD.actions.DeleteMember(relation.id, 0),
graph = action(iD.Graph([node, relation]));
expect(graph.entity(relation.id).members).to.eql([]);
var a = iD.Node({id: 'a'}),
b = iD.Node({id: 'b'}),
r = iD.Relation({members: [{id: 'a'}, {id: 'b'}]}),
action = iD.actions.DeleteMember(r.id, 0),
graph = action(iD.Graph([a, b, r]));
expect(graph.entity(r.id).members).to.eql([{id: 'b'}]);
});
it("deletes relations that become degenerate", function () {
var a = iD.Node({id: 'a'}),
r = iD.Relation({id: 'r', members: [{id: 'a'}]}),
action = iD.actions.DeleteMember(r.id, 0),
graph = action(iD.Graph([a, r]));
expect(graph.hasEntity('r')).to.be.undefined;
});
});