diff --git a/.gitignore b/.gitignore
index f960c0be3..f3c254660 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+.DS_Store
+node_modules
dist/iD.js
dist/iD.min.js
dist/iD.css
diff --git a/data/presets.yaml b/data/presets.yaml
index 0f895c861..8ca420e38 100644
--- a/data/presets.yaml
+++ b/data/presets.yaml
@@ -244,8 +244,16 @@ en:
label: Type
oneway:
label: One Way
+ options:
+ undefined: Assumed to be No
+ yes: Yes
+ no: No
oneway_yes:
label: One Way
+ options:
+ undefined: Assumed to be Yes
+ yes: Yes
+ no: No
opening_hours:
label: Hours
operator:
diff --git a/data/presets/fields.json b/data/presets/fields.json
index 4b80873f1..a40cfb894 100644
--- a/data/presets/fields.json
+++ b/data/presets/fields.json
@@ -575,13 +575,27 @@
"oneway": {
"key": "oneway",
"type": "check",
- "label": "One Way"
+ "label": "One Way",
+ "strings": {
+ "options": {
+ "undefined": "Assumed to be No",
+ "yes": "Yes",
+ "no": "No"
+ }
+ }
},
"oneway_yes": {
"key": "oneway",
"type": "check",
"default": "yes",
- "label": "One Way"
+ "label": "One Way",
+ "strings": {
+ "options": {
+ "undefined": "Assumed to be Yes",
+ "yes": "Yes",
+ "no": "No"
+ }
+ }
},
"opening_hours": {
"key": "opening_hours",
diff --git a/data/presets/fields/oneway.json b/data/presets/fields/oneway.json
index cdf746e4e..2b9b0fe02 100644
--- a/data/presets/fields/oneway.json
+++ b/data/presets/fields/oneway.json
@@ -1,5 +1,12 @@
{
"key": "oneway",
"type": "check",
- "label": "One Way"
+ "label": "One Way",
+ "strings": {
+ "options": {
+ "undefined": "Assumed to be No",
+ "yes": "Yes",
+ "no": "No"
+ }
+ }
}
diff --git a/data/presets/fields/oneway_yes.json b/data/presets/fields/oneway_yes.json
index b73d5a366..3e212eef1 100644
--- a/data/presets/fields/oneway_yes.json
+++ b/data/presets/fields/oneway_yes.json
@@ -2,5 +2,12 @@
"key": "oneway",
"type": "check",
"default": "yes",
- "label": "One Way"
+ "label": "One Way",
+ "strings": {
+ "options": {
+ "undefined": "Assumed to be Yes",
+ "yes": "Yes",
+ "no": "No"
+ }
+ }
}
diff --git a/data/presets/presets.json b/data/presets/presets.json
index 1510de2ab..9d8e849f1 100644
--- a/data/presets/presets.json
+++ b/data/presets/presets.json
@@ -3822,7 +3822,7 @@
"highway/motorway": {
"icon": "highway-motorway",
"fields": [
- "oneway",
+ "oneway_yes",
"maxspeed",
"structure",
"access",
diff --git a/data/presets/presets/highway/motorway.json b/data/presets/presets/highway/motorway.json
index d33aa952a..c05ac6e54 100644
--- a/data/presets/presets/highway/motorway.json
+++ b/data/presets/presets/highway/motorway.json
@@ -1,7 +1,7 @@
{
"icon": "highway-motorway",
"fields": [
- "oneway",
+ "oneway_yes",
"maxspeed",
"structure",
"access",
@@ -17,4 +17,4 @@
},
"terms": [],
"name": "Motorway"
-}
\ No newline at end of file
+}
diff --git a/dist/locales/en.json b/dist/locales/en.json
index dddd12d6b..c64e37b59 100644
--- a/dist/locales/en.json
+++ b/dist/locales/en.json
@@ -761,10 +761,20 @@
"label": "Type"
},
"oneway": {
- "label": "One Way"
+ "label": "One Way",
+ "options": {
+ "undefined": "Assumed to be No",
+ "yes": "Yes",
+ "no": "No"
+ }
},
"oneway_yes": {
- "label": "One Way"
+ "label": "One Way",
+ "options": {
+ "undefined": "Assumed to be Yes",
+ "yes": "Yes",
+ "no": "No"
+ }
},
"opening_hours": {
"label": "Hours"
diff --git a/index.html b/index.html
index 48cd10b82..09f51eca1 100644
--- a/index.html
+++ b/index.html
@@ -209,6 +209,7 @@
+
diff --git a/js/id/core/oneway_tags.js b/js/id/core/oneway_tags.js
new file mode 100644
index 000000000..0e8f7db35
--- /dev/null
+++ b/js/id/core/oneway_tags.js
@@ -0,0 +1,32 @@
+iD.oneWayTags = {
+ 'aerialway': {
+ 'chair_lift': true,
+ 'mixed_lift': true,
+ 't-bar': true,
+ 'j-bar': true,
+ 'platter': true,
+ 'rope_tow': true,
+ 'magic_carpet': true,
+ 'yes': true
+ },
+ 'highway': {
+ 'motorway': true,
+ 'motorway_link': true
+ },
+ 'junction': {
+ 'roundabout': true
+ },
+ 'man_made': {
+ 'piste:halfpipe': true,
+ 'pipeline': true
+ },
+ 'piste:type': {
+ 'downhill': true,
+ 'sled': true,
+ 'yes': true
+ },
+ 'waterway': {
+ 'river': true,
+ 'stream': true
+ }
+};
diff --git a/js/id/core/way.js b/js/id/core/way.js
index 530185fc9..3a6e6d6ec 100644
--- a/js/id/core/way.js
+++ b/js/id/core/way.js
@@ -48,11 +48,11 @@ _.extend(iD.Way.prototype, {
if (['no', '0'].indexOf(this.tags.oneway) !== -1) { return false; }
// implied oneway tag..
- return this.tags.waterway === 'river' ||
- this.tags.waterway === 'stream' ||
- this.tags.highway === 'motorway' ||
- this.tags.highway === 'motorway_link' ||
- this.tags.junction === 'roundabout';
+ for (var key in this.tags) {
+ if (key in iD.oneWayTags && (this.tags[key] in iD.oneWayTags[key]))
+ return true;
+ }
+ return false;
},
isClosed: function() {
diff --git a/js/id/ui/entity_editor.js b/js/id/ui/entity_editor.js
index 272f3555a..bc20bfb52 100644
--- a/js/id/ui/entity_editor.js
+++ b/js/id/ui/entity_editor.js
@@ -134,11 +134,13 @@ iD.ui.EntityEditor = function(context) {
function clean(o) {
var out = {}, k, v;
+ /*jshint -W083 */
for (k in o) {
if (k && (v = o[k]) !== undefined) {
- out[k] = v.trim();
+ out[k] = v.split(';').map(function(s) { return s.trim(); }).join(';');
}
}
+ /*jshint +W083 */
return out;
}
diff --git a/js/id/ui/preset/check.js b/js/id/ui/preset/check.js
index 2badb14fc..a8c145944 100644
--- a/js/id/ui/preset/check.js
+++ b/js/id/ui/preset/check.js
@@ -1,15 +1,38 @@
iD.ui.preset.check =
iD.ui.preset.defaultcheck = function(field) {
var event = d3.dispatch('change'),
- values = field.type === 'check' ?
- [undefined, 'yes', 'no'] :
- [undefined, 'yes'],
- value,
- box,
- text,
- label;
+ options = field.strings && field.strings.options,
+ values = [],
+ texts = [],
+ entity, value, box, text, label;
+
+ if (options) {
+ for (var k in options) {
+ values.push(k === 'undefined' ? undefined : k);
+ texts.push(field.t('check.' + k, { 'default': options[k] }));
+ }
+ } else {
+ values = [undefined, 'yes'];
+ texts = [t('inspector.unknown'), t('inspector.check.yes')];
+ if (field.type === 'check') {
+ values.push('no');
+ texts.push(t('inspector.check.no'));
+ }
+ }
var check = function(selection) {
+ // hack: pretend oneway field is a oneway_yes field
+ // where implied oneway tag exists (e.g. `junction=roundabout`) #2220, #1841
+ if (field.id === 'oneway') {
+ for (var key in entity.tags) {
+ if (key in iD.oneWayTags && (entity.tags[key] in iD.oneWayTags[key])) {
+ texts.shift();
+ texts.unshift(t('presets.fields.oneway_yes.check.undefined', { 'default': 'Assumed to be Yes' }));
+ break;
+ }
+ }
+ }
+
selection.classed('checkselect', 'true');
label = selection.selectAll('.preset-input-wrap')
@@ -24,7 +47,7 @@ iD.ui.preset.defaultcheck = function(field) {
.attr('id', 'preset-input-' + field.id);
enter.append('span')
- .text(t('inspector.unknown'))
+ .text(texts[0])
.attr('class', 'value');
box = label.select('input')
@@ -38,12 +61,17 @@ iD.ui.preset.defaultcheck = function(field) {
text = label.select('span.value');
};
+ check.entity = function(_) {
+ if (!arguments.length) return entity;
+ entity = _;
+ return check;
+ };
+
check.tags = function(tags) {
value = tags[field.key];
box.property('indeterminate', field.type === 'check' && !value);
box.property('checked', value === 'yes');
- text.text(value ? t('inspector.check.' + value, {default: value}) :
- field.type === 'check' ? t('inspector.unknown') : t('inspector.check.no'));
+ text.text(texts[values.indexOf(value)]);
label.classed('set', !!value);
};
diff --git a/js/id/ui/preset/combo.js b/js/id/ui/preset/combo.js
index c6f1e4e63..3d2149bf2 100644
--- a/js/id/ui/preset/combo.js
+++ b/js/id/ui/preset/combo.js
@@ -32,7 +32,7 @@ iD.ui.preset.typeCombo = function(field) {
function options(opts) {
combobox.data(opts.map(function(d) {
var o = {};
- o.title = o.value = d.replace('_', ' ');
+ o.title = o.value = d.replace(/_+/g, ' ');
return o;
}));
@@ -44,7 +44,12 @@ iD.ui.preset.typeCombo = function(field) {
}
function change() {
- var value = input.value().replace(' ', '_');
+ var value = input.value()
+ .split(';')
+ .map(function(s) { return s.trim(); })
+ .join(';')
+ .replace(/\s+/g, '_');
+
if (field.type === 'typeCombo' && !value) value = 'yes';
var t = {};
diff --git a/test/index.html b/test/index.html
index dec049083..213836440 100644
--- a/test/index.html
+++ b/test/index.html
@@ -188,6 +188,7 @@
+