From f8a99d03e257eeb6aed804212c4ee178c103c8a7 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 21 Jul 2014 14:32:10 -0400 Subject: [PATCH 1/8] If combobox is open, clicking on carat should close it --- js/lib/d3.combobox.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/lib/d3.combobox.js b/js/lib/d3.combobox.js index d59e463e1..174d08c9c 100644 --- a/js/lib/d3.combobox.js +++ b/js/lib/d3.combobox.js @@ -44,8 +44,12 @@ d3.combobox = function() { // on mousedown d3.event.stopPropagation(); d3.event.preventDefault(); - input.node().focus(); - fetch('', render); + if (!shown) { + input.node().focus(); + fetch('', render); + } else { + hide(); + } }); }); From a68cb30fd2e2c96a476895fd8e4da374821a511a Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 21 Jul 2014 14:37:42 -0400 Subject: [PATCH 2/8] Support option strings for combo fields (#1259, #1709) --- js/id/ui/preset/combo.js | 66 +++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/js/id/ui/preset/combo.js b/js/id/ui/preset/combo.js index eda700ad9..fe0247d8e 100644 --- a/js/id/ui/preset/combo.js +++ b/js/id/ui/preset/combo.js @@ -1,52 +1,61 @@ iD.ui.preset.combo = iD.ui.preset.typeCombo = function(field) { var event = d3.dispatch('change'), + optstrings = field.strings && field.strings.options, + strings = {}, input; + if (optstrings) { + _.each(optstrings, function(v, k) { + strings[k] = field.t('options.' + k, { 'default': v }); + }); + } else { + iD.taginfo().values({key: field.key}, function(err, data) { + if (!err) { + _.each(_.pluck(data, 'value'), function(k) { + strings[k] = k.replace(/_+/g, ' '); + }); + } + }); + } + function combo(selection) { var combobox = d3.combobox(); input = selection.selectAll('input') .data([0]); - input.enter().append('input') + var enter = input.enter() + .append('input') .attr('type', 'text') .attr('id', 'preset-input-' + field.id); + if (optstrings) { enter.attr('readonly', 'readonly'); } + input .call(combobox) .on('change', change) .on('blur', change) .each(function() { - if (field.options) { - options(field.options); - } else { - iD.taginfo().values({ - key: field.key - }, function(err, data) { - if (!err) options(_.pluck(data, 'value')); - }); - } + var keys = _.keys(strings); + combobox.data(keys.map(function(k) { + var o = {}; + o.title = o.value = strings[k]; + return o; + })); + + input.attr('placeholder', field.placeholder() || + (keys.length < 3 ? '' : keys.slice(0, 3).join(', ') + '...')); }); - - function options(opts) { - combobox.data(opts.map(function(d) { - var o = {}; - o.title = o.value = d.replace(/_+/g, ' '); - return o; - })); - - input.attr('placeholder', field.placeholder() || - (opts.length < 3 ? '' : opts.slice(0, 3).join(', ') + '...')); - } } function change() { - var value = input.value() - .split(';') - .map(function(s) { return s.trim(); }) - .join(';') - .replace(/\s+/g, '_'); + var optstring = _.find(_.keys(strings), function(k) { return strings[k] === input.value(); }), + value = optstring || (input.value() + .split(';') + .map(function(s) { return s.trim(); }) + .join(';') + .replace(/\s+/g, '_')); if (field.type === 'typeCombo' && !value) value = 'yes'; @@ -56,8 +65,9 @@ iD.ui.preset.typeCombo = function(field) { } combo.tags = function(tags) { - var value = tags[field.key] || ''; - if (field.type === 'typeCombo' && value === 'yes') value = ''; + var key = tags[field.key], + value = strings[key] || key || ''; + if (field.type === 'typeCombo' && value.toLowerCase() === 'yes') value = ''; input.value(value); }; From 0d5d0b19fc67cdb3e0fa0834c280b3f010612f6a Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 21 Jul 2014 15:56:03 -0400 Subject: [PATCH 3/8] Try to use strings when generating placeholder --- js/id/ui/preset/combo.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/js/id/ui/preset/combo.js b/js/id/ui/preset/combo.js index fe0247d8e..6941b1ece 100644 --- a/js/id/ui/preset/combo.js +++ b/js/id/ui/preset/combo.js @@ -37,15 +37,21 @@ iD.ui.preset.typeCombo = function(field) { .on('change', change) .on('blur', change) .each(function() { - var keys = _.keys(strings); + var keys = _.keys(strings), + strs = [], + placeholders; + combobox.data(keys.map(function(k) { - var o = {}; - o.title = o.value = strings[k]; + var s = strings[k], + o = {}; + o.title = o.value = s; + if (s.length < 20) { strs.push(s); } return o; })); + placeholders = strs.length ? strs : keys; input.attr('placeholder', field.placeholder() || - (keys.length < 3 ? '' : keys.slice(0, 3).join(', ') + '...')); + (placeholders.slice(0, 3).join(', ') + '...')); }); } From 98119b5b5bfadb9e1a08a86b729f84f660cb65dc Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 21 Jul 2014 16:27:30 -0400 Subject: [PATCH 4/8] Add option strings for many combo fields.. --- data/presets.yaml | 145 ++++++++ data/presets/fields.json | 350 +++++++++++------- data/presets/fields/aerialway/access.json | 16 +- .../fields/aerialway/summer/access.json | 16 +- data/presets/fields/cardinal_direction.json | 41 +- data/presets/fields/clock_direction.json | 10 +- data/presets/fields/electrified.json | 15 +- data/presets/fields/fire_hydrant/type.json | 18 +- data/presets/fields/internet_access.json | 9 +- data/presets/fields/parking.json | 22 +- data/presets/fields/piste/difficulty.json | 16 +- data/presets/fields/piste/grooming.json | 14 +- data/presets/fields/piste/type.json | 17 +- data/presets/fields/religion.json | 25 +- data/presets/fields/sac_scale.json | 15 +- data/presets/fields/service.json | 20 +- data/presets/fields/shelter_type.json | 23 +- data/presets/fields/smoking.json | 19 +- data/presets/fields/smoothness.json | 18 + data/presets/fields/sport_ice.json | 19 +- data/presets/fields/studio_type.json | 12 +- data/presets/fields/toilets/disposal.json | 12 +- data/presets/fields/tracktype.json | 14 +- data/presets/fields/trail_visibility.json | 15 +- data/presets/fields/tree_type.json | 14 +- data/presets/presets.json | 1 + data/presets/presets/highway/track.json | 3 +- dist/locales/en.json | 204 +++++++++- 28 files changed, 811 insertions(+), 292 deletions(-) create mode 100644 data/presets/fields/smoothness.json diff --git a/data/presets.yaml b/data/presets.yaml index 53fbe3b9c..5faeeda95 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -77,6 +77,10 @@ en: label: Type aerialway/access: label: Access + options: + entry: Entry + exit: Exit + both: Both aerialway/bubble: label: Bubble aerialway/capacity: @@ -92,6 +96,10 @@ en: placeholder: "2, 4, 8..." aerialway/summer/access: label: Access (summer) + options: + entry: Entry + exit: Exit + both: Both aeroway: label: Type amenity: @@ -119,6 +127,23 @@ en: placeholder: "50, 100, 200..." cardinal_direction: label: Direction + options: + "N": North + E: East + S: South + W: West + NE: Northeast + SE: Southeast + SW: Southwest + NW: Northwest + NNE: North-northeast + ENE: East-northeast + ESE: East-southeast + SSE: South-southeast + SSW: South-southwest + WSW: West-southwest + WNW: West-northwest + NNW: North-northwest clock_direction: label: Direction options: @@ -146,6 +171,12 @@ en: label: Description electrified: label: Electrification + placeholder: "Contact Line, Electrified Rail..." + options: + contact_line: Contact Line + rail: Electrified Rail + "yes": Yes (unspecified) + "no": "No" elevation: label: Elevation emergency: @@ -161,6 +192,11 @@ en: label: Fee fire_hydrant/type: label: Type + options: + pillar: Pillar/Aboveground + underground: Underground + wall: Wall + pond: Pond fixme: label: Fix Me fuel: @@ -279,15 +315,49 @@ en: label: Park and Ride parking: label: Type + options: + surface: Surface + multi-storey: Multilevel + underground: Underground + sheds: Sheds + carports: Carports + garage_boxes: Garage Boxes + lane: Roadside Lane phone: label: Phone placeholder: +31 42 123 4567 piste/difficulty: label: Difficulty + placeholder: "Easy, Intermediate, Advanced..." + options: + novice: Novice (instructional) + easy: Easy (green circle) + intermediate: Intermediate (blue square) + advanced: Advanced (black diamond) + expert: Expert (double black diamond) + freeride: Freeride (off-piste) + extreme: Extreme (climing equipment required) piste/grooming: label: Grooming + options: + classic: Classic + mogul: Mogul + backcountry: Backcountry + classic+skating: Classic and Skating + scooter: Scooter/Snowmobile + skating: Skating piste/type: label: Type + options: + downhill: Downhill + nordic: Nordic + skitour: Skitour + sled: Sled + hike: Hike + sleigh: Sleigh + ice_skate: Ice Skate + snow_park: Snow Park + playground: Playground place: label: Type population: @@ -328,20 +398,62 @@ en: label: Type sac_scale: label: Path Difficulty + placeholder: "Mountain Hiking, Alpine Hiking..." + options: + hiking: "T1: Hiking" + mountain_hiking: "T2: Mountain Hiking" + demanding_mountain_hiking: "T3: Demanding Mountain Hiking" + alpine_hiking: "T4: Alpine Hiking" + demanding_alpine_hiking: "T5: Demanding Alpine Hiking" + difficult_alpine_hiking: "T6: Difficult Alpine Hiking" seasonal: label: Seasonal service: label: Type + options: + parking_aisle: Parking Aisle + driveway: Driveway + alley: Alley + emergency_access: Emergency Access + drive-through: Drive-through shelter: label: Shelter shelter_type: label: Type + options: + public_transport: Public Transport + picnic_shelter: Picnic Shelter + weather_shelter: Weather Shelter + lean_to: Lean-to + basic_hut: Basic Hut + field_shelter: Field Shelter + rock_shelter: Rock Shelter shop: label: Type sloped_curb: label: Sloped Curb smoking: label: Smoking + placeholder: "No, Separated, Yes..." + options: + "no": No smoking anywhere + separated: "In smoking areas, not physically isolated" + isolated: "In smoking areas, physically isolated" + outside: Allowed outside + "yes": Allowed everywhere + dedicated: "Dedicated to smokers (e.g. smokers' club)" + smoothness: + label: Smoothness + placeholder: "Thin Rollers, Wheels, Off-Road..." + options: + excellent: "Thin Rollers: rollerblade, skateboard" + good: "Thin Wheels: racing bike" + intermediate: "Wheels: city bike, wheelchair, scooter" + bad: "Robust Wheels: trekking bike, car, rickshaw" + very_bad: "High Clearance: light duty off-road vehicle" + horrible: "Off-Road: heavy duty off-road vehicle" + very_horrible: "Specialized off-road: tractor, ATV" + impassible: Impassible / No wheeled vehicle social_facility_for: label: People served placeholder: "Homeless, Disabled, Child, etc" @@ -351,6 +463,12 @@ en: label: Sport sport_ice: label: Sport + options: + skating: Ice Skating + hockey: Ice Hockey + multi: Multi + curling: Curling + ice_stock: Ice Stock structure: label: Structure placeholder: Unknown @@ -362,6 +480,9 @@ en: ford: Ford studio_type: label: Type + options: + audio: Audio + video: Video supervised: label: Supervised surface: @@ -370,16 +491,40 @@ en: label: Tactile Paving toilets/disposal: label: Disposal + options: + flush: Flush + pitlatrine: Pit/Latrine + chemical: Chemical + bucket: Bucket tourism: label: Type towertype: label: Tower type tracktype: label: Type + placeholder: "Solid, Mostly Solid, Soft..." + options: + grade1: "Solid: paved or heavily compacted hardcore surface" + grade2: "Mostly Solid: gravel/rock with some soft material mixed in" + grade3: Even mixture of hard and soft materials + grade4: "Mostly Soft: soil/sand/grass with some hard material mixed in" + grade5: "Soft: soil/sand/grass" trail_visibility: label: Trail Visibility + placeholder: "Excellent, Good, Bad..." + options: + excellent: "Excellent: unambiguous path or markers everywhere" + good: "Good: markers visible, sometimes require searching" + intermediate: "Intermediate: few markers, path mostly visible" + bad: "Bad: no markers, path sometimes invisible/pathless" + horrible: "Horrible: often pathless, some orientation skills required" + "no": "No: pathless, excellent orientation skills required" tree_type: label: Type + options: + broad_leaved: Broad Leaved + conifer: Conifer + palm: Palm trees: label: Trees tunnel: diff --git a/data/presets/fields.json b/data/presets/fields.json index d4014c6ec..ea4f4b8b6 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -118,12 +118,14 @@ "aerialway/access": { "key": "aerialway:access", "type": "combo", - "options": [ - "entry", - "exit", - "both" - ], - "label": "Access" + "label": "Access", + "strings": { + "options": { + "entry": "Entry", + "exit": "Exit", + "both": "Both" + } + } }, "aerialway/bubble": { "key": "aerialway:bubble", @@ -156,12 +158,14 @@ "aerialway/summer/access": { "key": "aerialway:summer:access", "type": "combo", - "options": [ - "entry", - "exit", - "both" - ], - "label": "Access (summer)" + "label": "Access (summer)", + "strings": { + "options": { + "entry": "Entry", + "exit": "Exit", + "both": "Both" + } + } }, "aeroway": { "key": "aeroway", @@ -229,32 +233,31 @@ "cardinal_direction": { "key": "direction", "type": "combo", - "options": [ - "N", - "E", - "S", - "W", - "NE", - "SE", - "SW", - "NNE", - "ENE", - "ESE", - "SSE", - "SSW", - "WSW", - "WNW", - "NNW" - ], - "label": "Direction" + "label": "Direction", + "strings": { + "options": { + "N": "North", + "E": "East", + "S": "South", + "W": "West", + "NE": "Northeast", + "SE": "Southeast", + "SW": "Southwest", + "NW": "Northwest", + "NNE": "North-northeast", + "ENE": "East-northeast", + "ESE": "East-southeast", + "SSE": "South-southeast", + "SSW": "South-southwest", + "WSW": "West-southwest", + "WNW": "West-northwest", + "NNW": "North-northwest" + } + } }, "clock_direction": { "key": "direction", "type": "combo", - "options": [ - "clockwise", - "anticlockwise" - ], "label": "Direction", "strings": { "options": { @@ -318,12 +321,15 @@ "key": "electrified", "type": "combo", "label": "Electrification", - "options": [ - "contact_line", - "rail", - "yes", - "no" - ] + "placeholder": "Contact Line, Electrified Rail...", + "strings": { + "options": { + "contact_line": "Contact Line", + "rail": "Electrified Rail", + "yes": "Yes (unspecified)", + "no": "No" + } + } }, "elevation": { "key": "ele", @@ -361,13 +367,15 @@ "fire_hydrant/type": { "key": "fire_hydrant:type", "type": "combo", - "options": [ - "pillar", - "pond", - "underground", - "wall" - ], - "label": "Type" + "label": "Type", + "strings": { + "options": { + "pillar": "Pillar/Aboveground", + "underground": "Underground", + "wall": "Wall", + "pond": "Pond" + } + } }, "fixme": { "key": "fixme", @@ -495,13 +503,6 @@ "internet_access": { "key": "internet_access", "type": "combo", - "options": [ - "yes", - "no", - "wlan", - "wired", - "terminal" - ], "label": "Internet Access", "strings": { "options": { @@ -647,16 +648,18 @@ "parking": { "key": "parking", "type": "combo", - "options": [ - "surface", - "multi-storey", - "underground", - "sheds", - "carports", - "garage_boxes", - "lane" - ], - "label": "Type" + "label": "Type", + "strings": { + "options": { + "surface": "Surface", + "multi-storey": "Multilevel", + "underground": "Underground", + "sheds": "Sheds", + "carports": "Carports", + "garage_boxes": "Garage Boxes", + "lane": "Roadside Lane" + } + } }, "phone": { "key": "phone", @@ -669,17 +672,52 @@ "piste/difficulty": { "key": "piste:difficulty", "type": "combo", - "label": "Difficulty" + "label": "Difficulty", + "placeholder": "Easy, Intermediate, Advanced...", + "strings": { + "options": { + "novice": "Novice (instructional)", + "easy": "Easy (green circle)", + "intermediate": "Intermediate (blue square)", + "advanced": "Advanced (black diamond)", + "expert": "Expert (double black diamond)", + "freeride": "Freeride (off-piste)", + "extreme": "Extreme (climing equipment required)" + } + } }, "piste/grooming": { "key": "piste:grooming", "type": "combo", - "label": "Grooming" + "label": "Grooming", + "strings": { + "options": { + "classic": "Classic", + "mogul": "Mogul", + "backcountry": "Backcountry", + "classic+skating": "Classic and Skating", + "scooter": "Scooter/Snowmobile", + "skating": "Skating" + } + } }, "piste/type": { "key": "piste:type", "type": "typeCombo", - "label": "Type" + "label": "Type", + "strings": { + "options": { + "downhill": "Downhill", + "nordic": "Nordic", + "skitour": "Skitour", + "sled": "Sled", + "hike": "Hike", + "sleigh": "Sleigh", + "ice_skate": "Ice Skate", + "snow_park": "Snow Park", + "playground": "Playground" + } + } }, "place": { "key": "place", @@ -734,15 +772,6 @@ "religion": { "key": "religion", "type": "combo", - "options": [ - "christian", - "muslim", - "buddhist", - "jewish", - "hindu", - "shinto", - "taoist" - ], "label": "Religion", "strings": { "options": { @@ -783,7 +812,18 @@ "sac_scale": { "key": "sac_scale", "type": "combo", - "label": "Path Difficulty" + "label": "Path Difficulty", + "placeholder": "Mountain Hiking, Alpine Hiking...", + "strings": { + "options": { + "hiking": "T1: Hiking", + "mountain_hiking": "T2: Mountain Hiking", + "demanding_mountain_hiking": "T3: Demanding Mountain Hiking", + "alpine_hiking": "T4: Alpine Hiking", + "demanding_alpine_hiking": "T5: Demanding Alpine Hiking", + "difficult_alpine_hiking": "T6: Difficult Alpine Hiking" + } + } }, "seasonal": { "key": "seasonal", @@ -793,14 +833,16 @@ "service": { "key": "service", "type": "combo", - "options": [ - "parking_aisle", - "driveway", - "alley", - "drive-through", - "emergency_access" - ], - "label": "Type" + "label": "Type", + "strings": { + "options": { + "parking_aisle": "Parking Aisle", + "driveway": "Driveway", + "alley": "Alley", + "emergency_access": "Emergency Access", + "drive-through": "Drive-through" + } + } }, "shelter": { "key": "shelter", @@ -810,16 +852,18 @@ "shelter_type": { "key": "shelter_type", "type": "combo", - "options": [ - "public_transport", - "picnic_shelter", - "weather_shelter", - "lean_to", - "basic_hut", - "field_shelter", - "rock_shelter" - ], - "label": "Type" + "label": "Type", + "strings": { + "options": { + "public_transport": "Public Transport", + "picnic_shelter": "Picnic Shelter", + "weather_shelter": "Weather Shelter", + "lean_to": "Lean-to", + "basic_hut": "Basic Hut", + "field_shelter": "Field Shelter", + "rock_shelter": "Rock Shelter" + } + } }, "shop": { "key": "shop", @@ -834,13 +878,36 @@ "smoking": { "key": "smoking", "type": "combo", - "options": [ - "no", - "outside", - "separated", - "yes" - ], - "label": "Smoking" + "label": "Smoking", + "placeholder": "No, Separated, Yes...", + "strings": { + "options": { + "no": "No smoking anywhere", + "separated": "In smoking areas, not physically isolated", + "isolated": "In smoking areas, physically isolated", + "outside": "Allowed outside", + "yes": "Allowed everywhere", + "dedicated": "Dedicated to smokers (e.g. smokers' club)" + } + } + }, + "smoothness": { + "key": "smoothness", + "type": "combo", + "label": "Smoothness", + "placeholder": "Thin Rollers, Wheels, Off-Road...", + "strings": { + "options": { + "excellent": "Thin Rollers: rollerblade, skateboard", + "good": "Thin Wheels: racing bike", + "intermediate": "Wheels: city bike, wheelchair, scooter", + "bad": "Robust Wheels: trekking bike, car, rickshaw", + "very_bad": "High Clearance: light duty off-road vehicle", + "horrible": "Off-Road: heavy duty off-road vehicle", + "very_horrible": "Specialized off-road: tractor, ATV", + "impassible": "Impassible / No wheeled vehicle" + } + } }, "social_facility_for": { "key": "social_facility:for", @@ -879,14 +946,16 @@ "sport_ice": { "key": "sport", "type": "combo", - "options": [ - "skating", - "hockey", - "multi", - "curling", - "ice_stock" - ], - "label": "Sport" + "label": "Sport", + "strings": { + "options": { + "skating": "Ice Skating", + "hockey": "Ice Hockey", + "multi": "Multi", + "curling": "Curling", + "ice_stock": "Ice Stock" + } + } }, "structure": { "type": "radio", @@ -912,11 +981,13 @@ "studio_type": { "key": "type", "type": "combo", - "options": [ - "audio", - "video" - ], - "label": "Type" + "label": "Type", + "strings": { + "options": { + "audio": "Audio", + "video": "Video" + } + } }, "supervised": { "key": "supervised", @@ -936,7 +1007,15 @@ "toilets/disposal": { "key": "toilets:disposal", "type": "combo", - "label": "Disposal" + "label": "Disposal", + "strings": { + "options": { + "flush": "Flush", + "pitlatrine": "Pit/Latrine", + "chemical": "Chemical", + "bucket": "Bucket" + } + } }, "tourism": { "key": "tourism", @@ -951,22 +1030,45 @@ "tracktype": { "key": "tracktype", "type": "combo", - "label": "Type" + "label": "Type", + "placeholder": "Solid, Mostly Solid, Soft...", + "strings": { + "options": { + "grade1": "Solid: paved or heavily compacted hardcore surface", + "grade2": "Mostly Solid: gravel/rock with some soft material mixed in", + "grade3": "Even mixture of hard and soft materials", + "grade4": "Mostly Soft: soil/sand/grass with some hard material mixed in", + "grade5": "Soft: soil/sand/grass" + } + } }, "trail_visibility": { "key": "trail_visibility", "type": "combo", - "label": "Trail Visibility" + "label": "Trail Visibility", + "placeholder": "Excellent, Good, Bad...", + "strings": { + "options": { + "excellent": "Excellent: unambiguous path or markers everywhere", + "good": "Good: markers visible, sometimes require searching", + "intermediate": "Intermediate: few markers, path mostly visible", + "bad": "Bad: no markers, path sometimes invisible/pathless", + "horrible": "Horrible: often pathless, some orientation skills required", + "no": "No: pathless, excellent orientation skills required" + } + } }, "tree_type": { "key": "type", "type": "combo", - "options": [ - "broad_leaved", - "conifer", - "palm" - ], - "label": "Type" + "label": "Type", + "strings": { + "options": { + "broad_leaved": "Broad Leaved", + "conifer": "Conifer", + "palm": "Palm" + } + } }, "trees": { "key": "trees", diff --git a/data/presets/fields/aerialway/access.json b/data/presets/fields/aerialway/access.json index 64f7ffee5..8f23f1c75 100644 --- a/data/presets/fields/aerialway/access.json +++ b/data/presets/fields/aerialway/access.json @@ -1,10 +1,12 @@ { "key": "aerialway:access", "type": "combo", - "options": [ - "entry", - "exit", - "both" - ], - "label": "Access" -} \ No newline at end of file + "label": "Access", + "strings": { + "options": { + "entry": "Entry", + "exit": "Exit", + "both": "Both" + } + } +} diff --git a/data/presets/fields/aerialway/summer/access.json b/data/presets/fields/aerialway/summer/access.json index 1426e6160..717e4326e 100644 --- a/data/presets/fields/aerialway/summer/access.json +++ b/data/presets/fields/aerialway/summer/access.json @@ -1,10 +1,12 @@ { "key": "aerialway:summer:access", "type": "combo", - "options": [ - "entry", - "exit", - "both" - ], - "label": "Access (summer)" -} \ No newline at end of file + "label": "Access (summer)", + "strings": { + "options": { + "entry": "Entry", + "exit": "Exit", + "both": "Both" + } + } +} diff --git a/data/presets/fields/cardinal_direction.json b/data/presets/fields/cardinal_direction.json index 16e0d293a..7f7912b0b 100644 --- a/data/presets/fields/cardinal_direction.json +++ b/data/presets/fields/cardinal_direction.json @@ -1,22 +1,25 @@ { "key": "direction", "type": "combo", - "options": [ - "N", - "E", - "S", - "W", - "NE", - "SE", - "SW", - "NNE", - "ENE", - "ESE", - "SSE", - "SSW", - "WSW", - "WNW", - "NNW" - ], - "label": "Direction" -} \ No newline at end of file + "label": "Direction", + "strings": { + "options": { + "N": "North", + "E": "East", + "S": "South", + "W": "West", + "NE": "Northeast", + "SE": "Southeast", + "SW": "Southwest", + "NW": "Northwest", + "NNE": "North-northeast", + "ENE": "East-northeast", + "ESE": "East-southeast", + "SSE": "South-southeast", + "SSW": "South-southwest", + "WSW": "West-southwest", + "WNW": "West-northwest", + "NNW": "North-northwest" + } + } +} diff --git a/data/presets/fields/clock_direction.json b/data/presets/fields/clock_direction.json index 8b24111b6..8744ffc9f 100644 --- a/data/presets/fields/clock_direction.json +++ b/data/presets/fields/clock_direction.json @@ -1,15 +1,11 @@ { "key": "direction", "type": "combo", - "options": [ - "clockwise", - "anticlockwise" - ], "label": "Direction", "strings": { "options": { - "clockwise": "Clockwise", - "anticlockwise": "Counterclockwise" + "clockwise": "Clockwise", + "anticlockwise": "Counterclockwise" } } -} \ No newline at end of file +} diff --git a/data/presets/fields/electrified.json b/data/presets/fields/electrified.json index 327c77cee..71cc4a3ff 100644 --- a/data/presets/fields/electrified.json +++ b/data/presets/fields/electrified.json @@ -2,10 +2,13 @@ "key": "electrified", "type": "combo", "label": "Electrification", - "options": [ - "contact_line", - "rail", - "yes", - "no" - ] + "placeholder": "Contact Line, Electrified Rail...", + "strings": { + "options": { + "contact_line": "Contact Line", + "rail": "Electrified Rail", + "yes": "Yes (unspecified)", + "no": "No" + } + } } diff --git a/data/presets/fields/fire_hydrant/type.json b/data/presets/fields/fire_hydrant/type.json index 27325048c..13f5e6cde 100644 --- a/data/presets/fields/fire_hydrant/type.json +++ b/data/presets/fields/fire_hydrant/type.json @@ -1,11 +1,13 @@ { "key": "fire_hydrant:type", "type": "combo", - "options": [ - "pillar", - "pond", - "underground", - "wall" - ], - "label": "Type" -} \ No newline at end of file + "label": "Type", + "strings": { + "options": { + "pillar": "Pillar/Aboveground", + "underground": "Underground", + "wall": "Wall", + "pond": "Pond" + } + } +} diff --git a/data/presets/fields/internet_access.json b/data/presets/fields/internet_access.json index 2a0db4f5b..a628dfd5f 100644 --- a/data/presets/fields/internet_access.json +++ b/data/presets/fields/internet_access.json @@ -1,13 +1,6 @@ { "key": "internet_access", "type": "combo", - "options": [ - "yes", - "no", - "wlan", - "wired", - "terminal" - ], "label": "Internet Access", "strings": { "options": { @@ -18,4 +11,4 @@ "terminal": "Terminal" } } -} \ No newline at end of file +} diff --git a/data/presets/fields/parking.json b/data/presets/fields/parking.json index c287a4050..d0ff081d2 100644 --- a/data/presets/fields/parking.json +++ b/data/presets/fields/parking.json @@ -1,14 +1,16 @@ { "key": "parking", "type": "combo", - "options": [ - "surface", - "multi-storey", - "underground", - "sheds", - "carports", - "garage_boxes", - "lane" - ], - "label": "Type" + "label": "Type", + "strings": { + "options": { + "surface": "Surface", + "multi-storey": "Multilevel", + "underground": "Underground", + "sheds": "Sheds", + "carports": "Carports", + "garage_boxes": "Garage Boxes", + "lane": "Roadside Lane" + } + } } diff --git a/data/presets/fields/piste/difficulty.json b/data/presets/fields/piste/difficulty.json index a75ecaaf3..ebbe3d558 100644 --- a/data/presets/fields/piste/difficulty.json +++ b/data/presets/fields/piste/difficulty.json @@ -1,5 +1,17 @@ { "key": "piste:difficulty", "type": "combo", - "label": "Difficulty" -} \ No newline at end of file + "label": "Difficulty", + "placeholder": "Easy, Intermediate, Advanced...", + "strings": { + "options": { + "novice": "Novice (instructional)", + "easy": "Easy (green circle)", + "intermediate": "Intermediate (blue square)", + "advanced": "Advanced (black diamond)", + "expert": "Expert (double black diamond)", + "freeride": "Freeride (off-piste)", + "extreme": "Extreme (climing equipment required)" + } + } +} diff --git a/data/presets/fields/piste/grooming.json b/data/presets/fields/piste/grooming.json index 81005d9d8..a96c9f563 100644 --- a/data/presets/fields/piste/grooming.json +++ b/data/presets/fields/piste/grooming.json @@ -1,5 +1,15 @@ { "key": "piste:grooming", "type": "combo", - "label": "Grooming" -} \ No newline at end of file + "label": "Grooming", + "strings": { + "options": { + "classic": "Classic", + "mogul": "Mogul", + "backcountry": "Backcountry", + "classic+skating": "Classic and Skating", + "scooter": "Scooter/Snowmobile", + "skating": "Skating" + } + } +} diff --git a/data/presets/fields/piste/type.json b/data/presets/fields/piste/type.json index 93ec7f0b5..e9494d9e8 100644 --- a/data/presets/fields/piste/type.json +++ b/data/presets/fields/piste/type.json @@ -1,5 +1,18 @@ { "key": "piste:type", "type": "typeCombo", - "label": "Type" -} \ No newline at end of file + "label": "Type", + "strings": { + "options": { + "downhill": "Downhill", + "nordic": "Nordic", + "skitour": "Skitour", + "sled": "Sled", + "hike": "Hike", + "sleigh": "Sleigh", + "ice_skate": "Ice Skate", + "snow_park": "Snow Park", + "playground": "Playground" + } + } +} diff --git a/data/presets/fields/religion.json b/data/presets/fields/religion.json index 8e44ad1d8..79adf17b6 100644 --- a/data/presets/fields/religion.json +++ b/data/presets/fields/religion.json @@ -1,25 +1,16 @@ { "key": "religion", "type": "combo", - "options": [ - "christian", - "muslim", - "buddhist", - "jewish", - "hindu", - "shinto", - "taoist" - ], "label": "Religion", "strings": { "options": { - "christian": "Christian", - "muslim": "Muslim", - "buddhist": "Buddhist", - "jewish": "Jewish", - "hindu": "Hindu", - "shinto": "Shinto", - "taoist": "Taoist" + "christian": "Christian", + "muslim": "Muslim", + "buddhist": "Buddhist", + "jewish": "Jewish", + "hindu": "Hindu", + "shinto": "Shinto", + "taoist": "Taoist" } } -} \ No newline at end of file +} diff --git a/data/presets/fields/sac_scale.json b/data/presets/fields/sac_scale.json index 875568a26..c8f17e4ea 100644 --- a/data/presets/fields/sac_scale.json +++ b/data/presets/fields/sac_scale.json @@ -1,5 +1,16 @@ { "key": "sac_scale", "type": "combo", - "label": "Path Difficulty" -} \ No newline at end of file + "label": "Path Difficulty", + "placeholder": "Mountain Hiking, Alpine Hiking...", + "strings": { + "options": { + "hiking": "T1: Hiking", + "mountain_hiking": "T2: Mountain Hiking", + "demanding_mountain_hiking": "T3: Demanding Mountain Hiking", + "alpine_hiking": "T4: Alpine Hiking", + "demanding_alpine_hiking": "T5: Demanding Alpine Hiking", + "difficult_alpine_hiking": "T6: Difficult Alpine Hiking" + } + } +} diff --git a/data/presets/fields/service.json b/data/presets/fields/service.json index ca5eefa2b..6b5a82833 100644 --- a/data/presets/fields/service.json +++ b/data/presets/fields/service.json @@ -1,12 +1,14 @@ { "key": "service", "type": "combo", - "options": [ - "parking_aisle", - "driveway", - "alley", - "drive-through", - "emergency_access" - ], - "label": "Type" -} \ No newline at end of file + "label": "Type", + "strings": { + "options": { + "parking_aisle": "Parking Aisle", + "driveway": "Driveway", + "alley": "Alley", + "emergency_access": "Emergency Access", + "drive-through": "Drive-through" + } + } +} diff --git a/data/presets/fields/shelter_type.json b/data/presets/fields/shelter_type.json index a767b53ec..464985854 100644 --- a/data/presets/fields/shelter_type.json +++ b/data/presets/fields/shelter_type.json @@ -1,14 +1,17 @@ { "key": "shelter_type", "type": "combo", - "options": [ - "public_transport", - "picnic_shelter", - "weather_shelter", - "lean_to", - "basic_hut", - "field_shelter", - "rock_shelter" - ], - "label": "Type" + "label": "Type", + "strings": { + "options": { + "public_transport": "Public Transport", + "picnic_shelter": "Picnic Shelter", + "weather_shelter": "Weather Shelter", + "lean_to": "Lean-to", + "basic_hut": "Basic Hut", + "field_shelter": "Field Shelter", + "rock_shelter": "Rock Shelter" + } + } + } diff --git a/data/presets/fields/smoking.json b/data/presets/fields/smoking.json index 9c660c961..43a8aaaf9 100644 --- a/data/presets/fields/smoking.json +++ b/data/presets/fields/smoking.json @@ -1,11 +1,16 @@ { "key": "smoking", "type": "combo", - "options": [ - "no", - "outside", - "separated", - "yes" - ], - "label": "Smoking" + "label": "Smoking", + "placeholder": "No, Separated, Yes...", + "strings": { + "options": { + "no": "No smoking anywhere", + "separated": "In smoking areas, not physically isolated", + "isolated": "In smoking areas, physically isolated", + "outside": "Allowed outside", + "yes": "Allowed everywhere", + "dedicated": "Dedicated to smokers (e.g. smokers' club)" + } + } } diff --git a/data/presets/fields/smoothness.json b/data/presets/fields/smoothness.json new file mode 100644 index 000000000..b0a5583b7 --- /dev/null +++ b/data/presets/fields/smoothness.json @@ -0,0 +1,18 @@ +{ + "key": "smoothness", + "type": "combo", + "label": "Smoothness", + "placeholder": "Thin Rollers, Wheels, Off-Road...", + "strings": { + "options": { + "excellent": "Thin Rollers: rollerblade, skateboard", + "good": "Thin Wheels: racing bike", + "intermediate": "Wheels: city bike, wheelchair, scooter", + "bad": "Robust Wheels: trekking bike, car, rickshaw", + "very_bad": "High Clearance: light duty off-road vehicle", + "horrible": "Off-Road: heavy duty off-road vehicle", + "very_horrible": "Specialized off-road: tractor, ATV", + "impassible": "Impassible / No wheeled vehicle" + } + } +} diff --git a/data/presets/fields/sport_ice.json b/data/presets/fields/sport_ice.json index facfb728c..bbc12be97 100644 --- a/data/presets/fields/sport_ice.json +++ b/data/presets/fields/sport_ice.json @@ -1,12 +1,15 @@ { "key": "sport", "type": "combo", - "options": [ - "skating", - "hockey", - "multi", - "curling", - "ice_stock" - ], - "label": "Sport" + "label": "Sport", + "strings": { + "options": { + "skating": "Ice Skating", + "hockey": "Ice Hockey", + "multi": "Multi", + "curling": "Curling", + "ice_stock": "Ice Stock" + } + } + } diff --git a/data/presets/fields/studio_type.json b/data/presets/fields/studio_type.json index 27499ae65..c07699949 100644 --- a/data/presets/fields/studio_type.json +++ b/data/presets/fields/studio_type.json @@ -1,9 +1,11 @@ { "key": "type", "type": "combo", - "options": [ - "audio", - "video" - ], - "label": "Type" + "label": "Type", + "strings": { + "options": { + "audio": "Audio", + "video": "Video" + } + } } diff --git a/data/presets/fields/toilets/disposal.json b/data/presets/fields/toilets/disposal.json index 1ca02b975..9658c7e6c 100644 --- a/data/presets/fields/toilets/disposal.json +++ b/data/presets/fields/toilets/disposal.json @@ -1,5 +1,13 @@ { "key": "toilets:disposal", "type": "combo", - "label": "Disposal" -} \ No newline at end of file + "label": "Disposal", + "strings": { + "options": { + "flush": "Flush", + "pitlatrine": "Pit/Latrine", + "chemical": "Chemical", + "bucket": "Bucket" + } + } +} diff --git a/data/presets/fields/tracktype.json b/data/presets/fields/tracktype.json index 4736dfbc4..41277c4f6 100644 --- a/data/presets/fields/tracktype.json +++ b/data/presets/fields/tracktype.json @@ -1,5 +1,15 @@ { "key": "tracktype", "type": "combo", - "label": "Type" -} \ No newline at end of file + "label": "Type", + "placeholder": "Solid, Mostly Solid, Soft...", + "strings": { + "options": { + "grade1": "Solid: paved or heavily compacted hardcore surface", + "grade2": "Mostly Solid: gravel/rock with some soft material mixed in", + "grade3": "Even mixture of hard and soft materials", + "grade4": "Mostly Soft: soil/sand/grass with some hard material mixed in", + "grade5": "Soft: soil/sand/grass" + } + } +} diff --git a/data/presets/fields/trail_visibility.json b/data/presets/fields/trail_visibility.json index e2514da05..03e3d01e1 100644 --- a/data/presets/fields/trail_visibility.json +++ b/data/presets/fields/trail_visibility.json @@ -1,5 +1,16 @@ { "key": "trail_visibility", "type": "combo", - "label": "Trail Visibility" -} \ No newline at end of file + "label": "Trail Visibility", + "placeholder": "Excellent, Good, Bad...", + "strings": { + "options": { + "excellent": "Excellent: unambiguous path or markers everywhere", + "good": "Good: markers visible, sometimes require searching", + "intermediate": "Intermediate: few markers, path mostly visible", + "bad": "Bad: no markers, path sometimes invisible/pathless", + "horrible": "Horrible: often pathless, some orientation skills required", + "no": "No: pathless, excellent orientation skills required" + } + } +} diff --git a/data/presets/fields/tree_type.json b/data/presets/fields/tree_type.json index 3e668def3..028537ebe 100644 --- a/data/presets/fields/tree_type.json +++ b/data/presets/fields/tree_type.json @@ -1,10 +1,12 @@ { "key": "type", "type": "combo", - "options": [ - "broad_leaved", - "conifer", - "palm" - ], - "label": "Type" + "label": "Type", + "strings": { + "options": { + "broad_leaved": "Broad Leaved", + "conifer": "Conifer", + "palm": "Palm" + } + } } diff --git a/data/presets/presets.json b/data/presets/presets.json index 63f3d7cd5..fbca98d68 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -4324,6 +4324,7 @@ "icon": "highway-track", "fields": [ "tracktype", + "smoothness", "oneway", "maxspeed", "structure", diff --git a/data/presets/presets/highway/track.json b/data/presets/presets/highway/track.json index c0db026b1..1b921a928 100644 --- a/data/presets/presets/highway/track.json +++ b/data/presets/presets/highway/track.json @@ -2,6 +2,7 @@ "icon": "highway-track", "fields": [ "tracktype", + "smoothness", "oneway", "maxspeed", "structure", @@ -16,4 +17,4 @@ }, "terms": [], "name": "Track" -} \ No newline at end of file +} diff --git a/dist/locales/en.json b/dist/locales/en.json index 7cbc5718a..a11874e00 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -518,7 +518,12 @@ "label": "Type" }, "aerialway/access": { - "label": "Access" + "label": "Access", + "options": { + "entry": "Entry", + "exit": "Exit", + "both": "Both" + } }, "aerialway/bubble": { "label": "Bubble" @@ -539,7 +544,12 @@ "placeholder": "2, 4, 8..." }, "aerialway/summer/access": { - "label": "Access (summer)" + "label": "Access (summer)", + "options": { + "entry": "Entry", + "exit": "Exit", + "both": "Both" + } }, "aeroway": { "label": "Type" @@ -579,7 +589,25 @@ "placeholder": "50, 100, 200..." }, "cardinal_direction": { - "label": "Direction" + "label": "Direction", + "options": { + "N": "North", + "E": "East", + "S": "South", + "W": "West", + "NE": "Northeast", + "SE": "Southeast", + "SW": "Southwest", + "NW": "Northwest", + "NNE": "North-northeast", + "ENE": "East-northeast", + "ESE": "East-southeast", + "SSE": "South-southeast", + "SSW": "South-southwest", + "WSW": "West-southwest", + "WNW": "West-northwest", + "NNW": "North-northwest" + } }, "clock_direction": { "label": "Direction", @@ -619,7 +647,14 @@ "label": "Description" }, "electrified": { - "label": "Electrification" + "label": "Electrification", + "placeholder": "Contact Line, Electrified Rail...", + "options": { + "contact_line": "Contact Line", + "rail": "Electrified Rail", + "yes": "Yes (unspecified)", + "no": "No" + } }, "elevation": { "label": "Elevation" @@ -641,7 +676,13 @@ "label": "Fee" }, "fire_hydrant/type": { - "label": "Type" + "label": "Type", + "options": { + "pillar": "Pillar/Aboveground", + "underground": "Underground", + "wall": "Wall", + "pond": "Pond" + } }, "fixme": { "label": "Fix Me" @@ -810,20 +851,58 @@ "label": "Park and Ride" }, "parking": { - "label": "Type" + "label": "Type", + "options": { + "surface": "Surface", + "multi-storey": "Multilevel", + "underground": "Underground", + "sheds": "Sheds", + "carports": "Carports", + "garage_boxes": "Garage Boxes", + "lane": "Roadside Lane" + } }, "phone": { "label": "Phone", "placeholder": "+31 42 123 4567" }, "piste/difficulty": { - "label": "Difficulty" + "label": "Difficulty", + "placeholder": "Easy, Intermediate, Advanced...", + "options": { + "novice": "Novice (instructional)", + "easy": "Easy (green circle)", + "intermediate": "Intermediate (blue square)", + "advanced": "Advanced (black diamond)", + "expert": "Expert (double black diamond)", + "freeride": "Freeride (off-piste)", + "extreme": "Extreme (climing equipment required)" + } }, "piste/grooming": { - "label": "Grooming" + "label": "Grooming", + "options": { + "classic": "Classic", + "mogul": "Mogul", + "backcountry": "Backcountry", + "classic+skating": "Classic and Skating", + "scooter": "Scooter/Snowmobile", + "skating": "Skating" + } }, "piste/type": { - "label": "Type" + "label": "Type", + "options": { + "downhill": "Downhill", + "nordic": "Nordic", + "skitour": "Skitour", + "sled": "Sled", + "hike": "Hike", + "sleigh": "Sleigh", + "ice_skate": "Ice Skate", + "snow_park": "Snow Park", + "playground": "Playground" + } }, "place": { "label": "Type" @@ -880,19 +959,44 @@ "label": "Type" }, "sac_scale": { - "label": "Path Difficulty" + "label": "Path Difficulty", + "placeholder": "Mountain Hiking, Alpine Hiking...", + "options": { + "hiking": "T1: Hiking", + "mountain_hiking": "T2: Mountain Hiking", + "demanding_mountain_hiking": "T3: Demanding Mountain Hiking", + "alpine_hiking": "T4: Alpine Hiking", + "demanding_alpine_hiking": "T5: Demanding Alpine Hiking", + "difficult_alpine_hiking": "T6: Difficult Alpine Hiking" + } }, "seasonal": { "label": "Seasonal" }, "service": { - "label": "Type" + "label": "Type", + "options": { + "parking_aisle": "Parking Aisle", + "driveway": "Driveway", + "alley": "Alley", + "emergency_access": "Emergency Access", + "drive-through": "Drive-through" + } }, "shelter": { "label": "Shelter" }, "shelter_type": { - "label": "Type" + "label": "Type", + "options": { + "public_transport": "Public Transport", + "picnic_shelter": "Picnic Shelter", + "weather_shelter": "Weather Shelter", + "lean_to": "Lean-to", + "basic_hut": "Basic Hut", + "field_shelter": "Field Shelter", + "rock_shelter": "Rock Shelter" + } }, "shop": { "label": "Type" @@ -901,7 +1005,30 @@ "label": "Sloped Curb" }, "smoking": { - "label": "Smoking" + "label": "Smoking", + "placeholder": "No, Separated, Yes...", + "options": { + "no": "No smoking anywhere", + "separated": "In smoking areas, not physically isolated", + "isolated": "In smoking areas, physically isolated", + "outside": "Allowed outside", + "yes": "Allowed everywhere", + "dedicated": "Dedicated to smokers (e.g. smokers' club)" + } + }, + "smoothness": { + "label": "Smoothness", + "placeholder": "Thin Rollers, Wheels, Off-Road...", + "options": { + "excellent": "Thin Rollers: rollerblade, skateboard", + "good": "Thin Wheels: racing bike", + "intermediate": "Wheels: city bike, wheelchair, scooter", + "bad": "Robust Wheels: trekking bike, car, rickshaw", + "very_bad": "High Clearance: light duty off-road vehicle", + "horrible": "Off-Road: heavy duty off-road vehicle", + "very_horrible": "Specialized off-road: tractor, ATV", + "impassible": "Impassible / No wheeled vehicle" + } }, "social_facility_for": { "label": "People served", @@ -914,7 +1041,14 @@ "label": "Sport" }, "sport_ice": { - "label": "Sport" + "label": "Sport", + "options": { + "skating": "Ice Skating", + "hockey": "Ice Hockey", + "multi": "Multi", + "curling": "Curling", + "ice_stock": "Ice Stock" + } }, "structure": { "label": "Structure", @@ -928,7 +1062,11 @@ } }, "studio_type": { - "label": "Type" + "label": "Type", + "options": { + "audio": "Audio", + "video": "Video" + } }, "supervised": { "label": "Supervised" @@ -940,7 +1078,13 @@ "label": "Tactile Paving" }, "toilets/disposal": { - "label": "Disposal" + "label": "Disposal", + "options": { + "flush": "Flush", + "pitlatrine": "Pit/Latrine", + "chemical": "Chemical", + "bucket": "Bucket" + } }, "tourism": { "label": "Type" @@ -949,13 +1093,35 @@ "label": "Tower type" }, "tracktype": { - "label": "Type" + "label": "Type", + "placeholder": "Solid, Mostly Solid, Soft...", + "options": { + "grade1": "Solid: paved or heavily compacted hardcore surface", + "grade2": "Mostly Solid: gravel/rock with some soft material mixed in", + "grade3": "Even mixture of hard and soft materials", + "grade4": "Mostly Soft: soil/sand/grass with some hard material mixed in", + "grade5": "Soft: soil/sand/grass" + } }, "trail_visibility": { - "label": "Trail Visibility" + "label": "Trail Visibility", + "placeholder": "Excellent, Good, Bad...", + "options": { + "excellent": "Excellent: unambiguous path or markers everywhere", + "good": "Good: markers visible, sometimes require searching", + "intermediate": "Intermediate: few markers, path mostly visible", + "bad": "Bad: no markers, path sometimes invisible/pathless", + "horrible": "Horrible: often pathless, some orientation skills required", + "no": "No: pathless, excellent orientation skills required" + } }, "tree_type": { - "label": "Type" + "label": "Type", + "options": { + "broad_leaved": "Broad Leaved", + "conifer": "Conifer", + "palm": "Palm" + } }, "trees": { "label": "Trees" From 804a5233889ebfdd53b4af8517dd404cecc57e91 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 21 Jul 2014 19:03:13 -0400 Subject: [PATCH 5/8] handle async loading of strings from taginfo --- js/id/ui/preset/combo.js | 62 +++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/js/id/ui/preset/combo.js b/js/id/ui/preset/combo.js index 6941b1ece..12195a6c4 100644 --- a/js/id/ui/preset/combo.js +++ b/js/id/ui/preset/combo.js @@ -5,20 +5,6 @@ iD.ui.preset.typeCombo = function(field) { strings = {}, input; - if (optstrings) { - _.each(optstrings, function(v, k) { - strings[k] = field.t('options.' + k, { 'default': v }); - }); - } else { - iD.taginfo().values({key: field.key}, function(err, data) { - if (!err) { - _.each(_.pluck(data, 'value'), function(k) { - strings[k] = k.replace(/_+/g, ' '); - }); - } - }); - } - function combo(selection) { var combobox = d3.combobox(); @@ -37,22 +23,40 @@ iD.ui.preset.typeCombo = function(field) { .on('change', change) .on('blur', change) .each(function() { - var keys = _.keys(strings), - strs = [], - placeholders; - - combobox.data(keys.map(function(k) { - var s = strings[k], - o = {}; - o.title = o.value = s; - if (s.length < 20) { strs.push(s); } - return o; - })); - - placeholders = strs.length ? strs : keys; - input.attr('placeholder', field.placeholder() || - (placeholders.slice(0, 3).join(', ') + '...')); + if (optstrings) { + _.each(optstrings, function(v, k) { + strings[k] = field.t('options.' + k, { 'default': v }); + }); + stringsLoaded(); + } else { + iD.taginfo().values({key: field.key}, function(err, data) { + if (!err) { + _.each(_.pluck(data, 'value'), function(k) { + strings[k] = k.replace(/_+/g, ' '); + }); + stringsLoaded(); + } + }); + } }); + + function stringsLoaded() { + var keys = _.keys(strings), + strs = [], + placeholders; + + combobox.data(keys.map(function(k) { + var s = strings[k], + o = {}; + o.title = o.value = s; + if (s.length < 20) { strs.push(s); } + return o; + })); + + placeholders = strs.length ? strs : keys; + input.attr('placeholder', field.placeholder() || + (placeholders.slice(0, 3).join(', ') + '...')); + } } function change() { From af0be9a59ba710c0c5b8730af1cb28ea74225a1f Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 21 Jul 2014 19:06:24 -0400 Subject: [PATCH 6/8] remove unused `indexed` field property --- data/presets/fields.json | 1 - data/presets/fields/cuisine.json | 3 +-- data/presets/schema/field.json | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/data/presets/fields.json b/data/presets/fields.json index ea4f4b8b6..8a5ff8824 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -299,7 +299,6 @@ "cuisine": { "key": "cuisine", "type": "combo", - "indexed": true, "label": "Cuisine" }, "denomination": { diff --git a/data/presets/fields/cuisine.json b/data/presets/fields/cuisine.json index 654b05302..307826ca7 100644 --- a/data/presets/fields/cuisine.json +++ b/data/presets/fields/cuisine.json @@ -1,6 +1,5 @@ { "key": "cuisine", "type": "combo", - "indexed": true, "label": "Cuisine" -} \ No newline at end of file +} diff --git a/data/presets/schema/field.json b/data/presets/schema/field.json index 3cc081660..c51c0cddd 100644 --- a/data/presets/schema/field.json +++ b/data/presets/schema/field.json @@ -79,9 +79,6 @@ "default": { "type": "string" }, - "indexed": { - "type": "boolean" - }, "options": { "type": "array", "items": { From 2b96064ed37946af9ac2845a4bc4aac32353b724 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 22 Jul 2014 12:14:13 -0400 Subject: [PATCH 7/8] Continue support for options array of keys --- js/id/ui/preset/combo.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/id/ui/preset/combo.js b/js/id/ui/preset/combo.js index 12195a6c4..dc1b93d88 100644 --- a/js/id/ui/preset/combo.js +++ b/js/id/ui/preset/combo.js @@ -2,6 +2,7 @@ iD.ui.preset.combo = iD.ui.preset.typeCombo = function(field) { var event = d3.dispatch('change'), optstrings = field.strings && field.strings.options, + optarray = field.options, strings = {}, input; @@ -28,6 +29,11 @@ iD.ui.preset.typeCombo = function(field) { strings[k] = field.t('options.' + k, { 'default': v }); }); stringsLoaded(); + } else if (optarray) { + _.each(optarray, function(k) { + strings[k] = k.replace(/_+/g, ' '); + }); + stringsLoaded(); } else { iD.taginfo().values({key: field.key}, function(err, data) { if (!err) { @@ -53,7 +59,7 @@ iD.ui.preset.typeCombo = function(field) { return o; })); - placeholders = strs.length ? strs : keys; + placeholders = strs.length > 1 ? strs : keys; input.attr('placeholder', field.placeholder() || (placeholders.slice(0, 3).join(', ') + '...')); } From cc7649406dbb31e84e4212d6e46c444912bd52eb Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 22 Jul 2014 12:15:05 -0400 Subject: [PATCH 8/8] Update preset options according to #2296 --- data/presets.yaml | 35 ------------ data/presets/fields.json | 80 +++++++++------------------ data/presets/fields/religion.json | 13 +---- data/presets/fields/service.json | 16 +++--- data/presets/fields/shelter_type.json | 14 +---- data/presets/fields/sport_ice.json | 17 +++--- data/presets/fields/studio_type.json | 10 ++-- data/presets/fields/tree_type.json | 12 ++-- dist/locales/en.json | 53 ++---------------- 9 files changed, 56 insertions(+), 194 deletions(-) diff --git a/data/presets.yaml b/data/presets.yaml index 5faeeda95..e39e89739 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -380,14 +380,6 @@ en: label: Type religion: label: Religion - options: - christian: Christian - muslim: Muslim - buddhist: Buddhist - jewish: Jewish - hindu: Hindu - shinto: Shinto - taoist: Taoist restriction: label: Type restrictions: @@ -410,24 +402,10 @@ en: label: Seasonal service: label: Type - options: - parking_aisle: Parking Aisle - driveway: Driveway - alley: Alley - emergency_access: Emergency Access - drive-through: Drive-through shelter: label: Shelter shelter_type: label: Type - options: - public_transport: Public Transport - picnic_shelter: Picnic Shelter - weather_shelter: Weather Shelter - lean_to: Lean-to - basic_hut: Basic Hut - field_shelter: Field Shelter - rock_shelter: Rock Shelter shop: label: Type sloped_curb: @@ -463,12 +441,6 @@ en: label: Sport sport_ice: label: Sport - options: - skating: Ice Skating - hockey: Ice Hockey - multi: Multi - curling: Curling - ice_stock: Ice Stock structure: label: Structure placeholder: Unknown @@ -480,9 +452,6 @@ en: ford: Ford studio_type: label: Type - options: - audio: Audio - video: Video supervised: label: Supervised surface: @@ -521,10 +490,6 @@ en: "no": "No: pathless, excellent orientation skills required" tree_type: label: Type - options: - broad_leaved: Broad Leaved - conifer: Conifer - palm: Palm trees: label: Trees tunnel: diff --git a/data/presets/fields.json b/data/presets/fields.json index 8a5ff8824..cf554ae8d 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -771,18 +771,7 @@ "religion": { "key": "religion", "type": "combo", - "label": "Religion", - "strings": { - "options": { - "christian": "Christian", - "muslim": "Muslim", - "buddhist": "Buddhist", - "jewish": "Jewish", - "hindu": "Hindu", - "shinto": "Shinto", - "taoist": "Taoist" - } - } + "label": "Religion" }, "restriction": { "key": "restriction", @@ -833,15 +822,13 @@ "key": "service", "type": "combo", "label": "Type", - "strings": { - "options": { - "parking_aisle": "Parking Aisle", - "driveway": "Driveway", - "alley": "Alley", - "emergency_access": "Emergency Access", - "drive-through": "Drive-through" - } - } + "options": [ + "parking_aisle", + "driveway", + "alley", + "emergency_access", + "drive-through" + ] }, "shelter": { "key": "shelter", @@ -851,18 +838,7 @@ "shelter_type": { "key": "shelter_type", "type": "combo", - "label": "Type", - "strings": { - "options": { - "public_transport": "Public Transport", - "picnic_shelter": "Picnic Shelter", - "weather_shelter": "Weather Shelter", - "lean_to": "Lean-to", - "basic_hut": "Basic Hut", - "field_shelter": "Field Shelter", - "rock_shelter": "Rock Shelter" - } - } + "label": "Type" }, "shop": { "key": "shop", @@ -946,15 +922,13 @@ "key": "sport", "type": "combo", "label": "Sport", - "strings": { - "options": { - "skating": "Ice Skating", - "hockey": "Ice Hockey", - "multi": "Multi", - "curling": "Curling", - "ice_stock": "Ice Stock" - } - } + "options": [ + "skating", + "hockey", + "multi", + "curling", + "ice_stock" + ] }, "structure": { "type": "radio", @@ -981,12 +955,10 @@ "key": "type", "type": "combo", "label": "Type", - "strings": { - "options": { - "audio": "Audio", - "video": "Video" - } - } + "options": [ + "audio", + "video" + ] }, "supervised": { "key": "supervised", @@ -1061,13 +1033,11 @@ "key": "type", "type": "combo", "label": "Type", - "strings": { - "options": { - "broad_leaved": "Broad Leaved", - "conifer": "Conifer", - "palm": "Palm" - } - } + "options": [ + "broad_leaved", + "conifer", + "palm" + ] }, "trees": { "key": "trees", diff --git a/data/presets/fields/religion.json b/data/presets/fields/religion.json index 79adf17b6..36b5b67c6 100644 --- a/data/presets/fields/religion.json +++ b/data/presets/fields/religion.json @@ -1,16 +1,5 @@ { "key": "religion", "type": "combo", - "label": "Religion", - "strings": { - "options": { - "christian": "Christian", - "muslim": "Muslim", - "buddhist": "Buddhist", - "jewish": "Jewish", - "hindu": "Hindu", - "shinto": "Shinto", - "taoist": "Taoist" - } - } + "label": "Religion" } diff --git a/data/presets/fields/service.json b/data/presets/fields/service.json index 6b5a82833..5686b0a6e 100644 --- a/data/presets/fields/service.json +++ b/data/presets/fields/service.json @@ -2,13 +2,11 @@ "key": "service", "type": "combo", "label": "Type", - "strings": { - "options": { - "parking_aisle": "Parking Aisle", - "driveway": "Driveway", - "alley": "Alley", - "emergency_access": "Emergency Access", - "drive-through": "Drive-through" - } - } + "options": [ + "parking_aisle", + "driveway", + "alley", + "emergency_access", + "drive-through" + ] } diff --git a/data/presets/fields/shelter_type.json b/data/presets/fields/shelter_type.json index 464985854..2ea69ac6b 100644 --- a/data/presets/fields/shelter_type.json +++ b/data/presets/fields/shelter_type.json @@ -1,17 +1,5 @@ { "key": "shelter_type", "type": "combo", - "label": "Type", - "strings": { - "options": { - "public_transport": "Public Transport", - "picnic_shelter": "Picnic Shelter", - "weather_shelter": "Weather Shelter", - "lean_to": "Lean-to", - "basic_hut": "Basic Hut", - "field_shelter": "Field Shelter", - "rock_shelter": "Rock Shelter" - } - } - + "label": "Type" } diff --git a/data/presets/fields/sport_ice.json b/data/presets/fields/sport_ice.json index bbc12be97..7e5133bf9 100644 --- a/data/presets/fields/sport_ice.json +++ b/data/presets/fields/sport_ice.json @@ -2,14 +2,11 @@ "key": "sport", "type": "combo", "label": "Sport", - "strings": { - "options": { - "skating": "Ice Skating", - "hockey": "Ice Hockey", - "multi": "Multi", - "curling": "Curling", - "ice_stock": "Ice Stock" - } - } - + "options": [ + "skating", + "hockey", + "multi", + "curling", + "ice_stock" + ] } diff --git a/data/presets/fields/studio_type.json b/data/presets/fields/studio_type.json index c07699949..8d452be7a 100644 --- a/data/presets/fields/studio_type.json +++ b/data/presets/fields/studio_type.json @@ -2,10 +2,8 @@ "key": "type", "type": "combo", "label": "Type", - "strings": { - "options": { - "audio": "Audio", - "video": "Video" - } - } + "options": [ + "audio", + "video" + ] } diff --git a/data/presets/fields/tree_type.json b/data/presets/fields/tree_type.json index 028537ebe..54faa3793 100644 --- a/data/presets/fields/tree_type.json +++ b/data/presets/fields/tree_type.json @@ -2,11 +2,9 @@ "key": "type", "type": "combo", "label": "Type", - "strings": { - "options": { - "broad_leaved": "Broad Leaved", - "conifer": "Conifer", - "palm": "Palm" - } - } + "options": [ + "broad_leaved", + "conifer", + "palm" + ] } diff --git a/dist/locales/en.json b/dist/locales/en.json index a11874e00..ab3ac13d2 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -935,16 +935,7 @@ "label": "Type" }, "religion": { - "label": "Religion", - "options": { - "christian": "Christian", - "muslim": "Muslim", - "buddhist": "Buddhist", - "jewish": "Jewish", - "hindu": "Hindu", - "shinto": "Shinto", - "taoist": "Taoist" - } + "label": "Religion" }, "restriction": { "label": "Type" @@ -974,29 +965,13 @@ "label": "Seasonal" }, "service": { - "label": "Type", - "options": { - "parking_aisle": "Parking Aisle", - "driveway": "Driveway", - "alley": "Alley", - "emergency_access": "Emergency Access", - "drive-through": "Drive-through" - } + "label": "Type" }, "shelter": { "label": "Shelter" }, "shelter_type": { - "label": "Type", - "options": { - "public_transport": "Public Transport", - "picnic_shelter": "Picnic Shelter", - "weather_shelter": "Weather Shelter", - "lean_to": "Lean-to", - "basic_hut": "Basic Hut", - "field_shelter": "Field Shelter", - "rock_shelter": "Rock Shelter" - } + "label": "Type" }, "shop": { "label": "Type" @@ -1041,14 +1016,7 @@ "label": "Sport" }, "sport_ice": { - "label": "Sport", - "options": { - "skating": "Ice Skating", - "hockey": "Ice Hockey", - "multi": "Multi", - "curling": "Curling", - "ice_stock": "Ice Stock" - } + "label": "Sport" }, "structure": { "label": "Structure", @@ -1062,11 +1030,7 @@ } }, "studio_type": { - "label": "Type", - "options": { - "audio": "Audio", - "video": "Video" - } + "label": "Type" }, "supervised": { "label": "Supervised" @@ -1116,12 +1080,7 @@ } }, "tree_type": { - "label": "Type", - "options": { - "broad_leaved": "Broad Leaved", - "conifer": "Conifer", - "palm": "Palm" - } + "label": "Type" }, "trees": { "label": "Trees"