mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Checkmark fields now support custom string options
oneway fields now show "Assumed to be No" or "Assumed to be Yes" instead of "Unknown" #2220
This commit is contained in:
@@ -240,8 +240,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:
|
||||
|
||||
@@ -570,13 +570,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",
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3822,7 +3822,7 @@
|
||||
"highway/motorway": {
|
||||
"icon": "highway-motorway",
|
||||
"fields": [
|
||||
"oneway",
|
||||
"oneway_yes",
|
||||
"maxspeed",
|
||||
"structure",
|
||||
"access",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"icon": "highway-motorway",
|
||||
"fields": [
|
||||
"oneway",
|
||||
"oneway_yes",
|
||||
"maxspeed",
|
||||
"structure",
|
||||
"access",
|
||||
@@ -17,4 +17,4 @@
|
||||
},
|
||||
"terms": [],
|
||||
"name": "Motorway"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+12
-2
@@ -743,10 +743,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"
|
||||
|
||||
+20
-10
@@ -1,13 +1,24 @@
|
||||
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 = [],
|
||||
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) {
|
||||
selection.classed('checkselect', 'true');
|
||||
@@ -24,7 +35,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')
|
||||
@@ -42,8 +53,7 @@ iD.ui.preset.defaultcheck = function(field) {
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user