diff --git a/data/core.yaml b/data/core.yaml index 1617207af..eee956b15 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -25,6 +25,7 @@ en: annotation: point: Added a point. vertex: Added a node to a way. + relation: Added a relation. start: annotation: line: Started a line. @@ -176,6 +177,7 @@ en: all_tags: All tags all_members: All members all_relations: All relations + new_relation: New relation... role: Role choose: Select feature type results: "{n} results for {search}" diff --git a/dist/locales/en.json b/dist/locales/en.json index 029021dc0..5b8c0188c 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -30,7 +30,8 @@ "add": { "annotation": { "point": "Added a point.", - "vertex": "Added a node to a way." + "vertex": "Added a node to a way.", + "relation": "Added a relation." } }, "start": { @@ -219,6 +220,7 @@ "all_tags": "All tags", "all_members": "All members", "all_relations": "All relations", + "new_relation": "New relation...", "role": "Role", "choose": "Select feature type", "results": "{n} results for {search}", diff --git a/js/id/ui/raw_membership_editor.js b/js/id/ui/raw_membership_editor.js index 24a2e9ab5..26a1ea9d7 100644 --- a/js/id/ui/raw_membership_editor.js +++ b/js/id/ui/raw_membership_editor.js @@ -14,9 +14,22 @@ iD.ui.RawMembershipEditor = function(context) { function addMembership(d, role) { showBlank = false; - context.perform( - iD.actions.AddMember(d.relation.id, {id: id, type: context.entity(id).type, role: role}), - t('operations.add_member.annotation')) + + if (d.relation) { + context.perform( + iD.actions.AddMember(d.relation.id, {id: id, type: context.entity(id).type, role: role}), + t('operations.add_member.annotation')); + + } else { + var relation = iD.Relation(); + + context.perform( + iD.actions.AddEntity(relation), + iD.actions.AddMember(relation.id, {id: id, type: context.entity(id).type, role: role}), + t('operations.add.annotation.relation')); + + context.enter(iD.modes.Select(context, [relation.id])); + } } function deleteMembership(d) { @@ -26,7 +39,10 @@ iD.ui.RawMembershipEditor = function(context) { } function relations(q) { - var result = [], + var result = [{ + relation: null, + value: t('inspector.new_relation') + }], graph = context.graph(); context.intersects(context.extent()).forEach(function(entity) {