mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-02 21:21:37 +02:00
extract preset fields
This commit is contained in:
+5
-3
@@ -160,7 +160,7 @@
|
||||
<script src='js/id/presets.js'></script>
|
||||
<script src='js/id/presets/preset.js'></script>
|
||||
<script src='js/id/presets/category.js'></script>
|
||||
<script src='js/id/presets/presets.js'></script>
|
||||
<script src='js/id/presets/collection.js'></script>
|
||||
|
||||
<script src='js/id/connection.js'></script>
|
||||
<script src='js/id/validate.js'></script>
|
||||
@@ -190,7 +190,8 @@
|
||||
|
||||
var id = iD();
|
||||
|
||||
iD.util.asyncMap(['keys.json', 'presets/presets.json', 'presets/defaults.json', 'presets/categories.json'], d3.json, function(err, data) {
|
||||
iD.util.asyncMap(['keys.json', 'presets/presets.json', 'presets/defaults.json',
|
||||
'presets/categories.json', 'presets/forms.json'], d3.json, function(err, data) {
|
||||
id.connection()
|
||||
.keys(data[0]);
|
||||
|
||||
@@ -198,7 +199,8 @@
|
||||
.load({
|
||||
presets: data[1],
|
||||
defaults: data[2],
|
||||
categories: data[3]
|
||||
categories: data[3],
|
||||
forms: data[4]
|
||||
});
|
||||
|
||||
d3.select("#iD")
|
||||
|
||||
+7
-2
@@ -14,13 +14,18 @@ iD.presets = function(context) {
|
||||
form: []
|
||||
},
|
||||
all = iD.presets.Collection([iD.presets.Preset(other)]),
|
||||
defaults = {};
|
||||
defaults = {},
|
||||
forms = {};
|
||||
|
||||
all.load = function(d) {
|
||||
|
||||
if (d.forms) {
|
||||
forms = d.forms;
|
||||
}
|
||||
|
||||
if (d.presets) {
|
||||
d.presets.forEach(function(d) {
|
||||
all.collection.push(iD.presets.Preset(d));
|
||||
all.collection.push(iD.presets.Preset(d, forms));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
iD.presets.Preset = function(preset) {
|
||||
iD.presets.Preset = function(preset, forms) {
|
||||
|
||||
preset.form = preset.form.map(function(f) {
|
||||
if (typeof f === 'string') {
|
||||
return forms[f];
|
||||
} else {
|
||||
return f;
|
||||
}
|
||||
});
|
||||
|
||||
preset.matchType = function(entity, resolver) {
|
||||
return preset.match.type.indexOf(entity.geometry(resolver)) >= 0;
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"cuisine": {
|
||||
"key": "cuisine",
|
||||
"type": "combo",
|
||||
"indexed": true
|
||||
},
|
||||
"internet_access": {
|
||||
"key": "internet_access",
|
||||
"title": "Internet Access",
|
||||
"type": "select",
|
||||
"options": ["yes", "no", "wlan", "wired", "terminal"]
|
||||
},
|
||||
"building_area": {
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"default": { "area": "yes" },
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
"address": {
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
},
|
||||
"operator": {
|
||||
"key": "operator",
|
||||
"type": "text"
|
||||
},
|
||||
"religion": {
|
||||
"key": "religion",
|
||||
"type": "select",
|
||||
"options": ["christian", "muslim", "buddhist", "jewish", "hindu", "shinto", "taoist"]
|
||||
},
|
||||
"denomination": {
|
||||
"key": "denomination",
|
||||
"type": "combo"
|
||||
},
|
||||
"building": {
|
||||
"key": "building",
|
||||
"type": "combo"
|
||||
},
|
||||
"fee": {
|
||||
"key": "fee",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
"access": {
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
"atm": {
|
||||
"key": "atm",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
"shelter": {
|
||||
"key": "shelter",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
"emergency": {
|
||||
"key": "emergency",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
"oneway": {
|
||||
"key": "oneway",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
"access": {
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
"maxspeed": {
|
||||
"key": "maxspeed",
|
||||
"type": "combo"
|
||||
},
|
||||
"surface": {
|
||||
"key": "surface",
|
||||
"type": "combo"
|
||||
}
|
||||
}
|
||||
+23
-363
@@ -9,31 +9,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "cafe",
|
||||
"form": [
|
||||
{
|
||||
"key": "cuisine",
|
||||
"type": "combo",
|
||||
"indexed": true
|
||||
},
|
||||
{
|
||||
"key": "internet_access",
|
||||
"title": "Internet Access",
|
||||
"type": "select",
|
||||
"options": ["yes", "no", "wlan", "wired", "terminal"]
|
||||
},
|
||||
{
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"],
|
||||
"default": {
|
||||
"area": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["cuisine", "internet_access", "building_area", "address"]
|
||||
},
|
||||
{
|
||||
"title": "Park",
|
||||
@@ -69,24 +45,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "grocery",
|
||||
"form": [
|
||||
{
|
||||
"key": "operator",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"],
|
||||
"default": {
|
||||
"area": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["operator", "building_area", "address"]
|
||||
},
|
||||
{
|
||||
"title": "Restaurant",
|
||||
@@ -98,24 +57,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "restaurant",
|
||||
"form": [
|
||||
{
|
||||
"key": "cuisine",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"],
|
||||
"default": {
|
||||
"area": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["cuisine", "building_area", "address"]
|
||||
},
|
||||
{
|
||||
"title": "Place of worship",
|
||||
@@ -127,29 +69,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "place-of-worship",
|
||||
"form": [
|
||||
{
|
||||
"key": "religion",
|
||||
"type": "select",
|
||||
"options": ["christian", "muslim", "buddhist", "jewish", "hindu", "shinto", "taoist"]
|
||||
},
|
||||
{
|
||||
"key": "denomination",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"],
|
||||
"default": {
|
||||
"area": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["religion", "denomination", "building_area", "address"]
|
||||
},
|
||||
{
|
||||
"title": "School",
|
||||
@@ -161,21 +81,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "school",
|
||||
"form": [
|
||||
{
|
||||
"key": "operator",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["operator", "building", "address"]
|
||||
},
|
||||
{
|
||||
"title": "Parking",
|
||||
@@ -187,21 +93,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "parking",
|
||||
"form": [
|
||||
{
|
||||
"key": "fee",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["fee", "access", "address"]
|
||||
},
|
||||
{
|
||||
"title": "Bank",
|
||||
@@ -213,25 +105,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "bank",
|
||||
"form": [
|
||||
{
|
||||
"key": "atm",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"],
|
||||
"default": {
|
||||
"area": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["atm", "building_area", "address"]
|
||||
},
|
||||
{
|
||||
"title": "Fast food",
|
||||
@@ -243,24 +117,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "fast-food",
|
||||
"form": [
|
||||
{
|
||||
"key": "cuisine",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"],
|
||||
"default": {
|
||||
"area": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["cuisine", "building_area", "address"]
|
||||
},
|
||||
{
|
||||
"title": "Bar",
|
||||
@@ -272,20 +129,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "bar",
|
||||
"form": [
|
||||
{
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"],
|
||||
"default": {
|
||||
"area": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["building_area", "address"]
|
||||
},
|
||||
{
|
||||
"title": "Bus stop",
|
||||
@@ -297,17 +141,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "bus",
|
||||
"form": [
|
||||
{
|
||||
"key": "operator",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "shelter",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
}
|
||||
]
|
||||
"form": ["operator", "shelter"]
|
||||
},
|
||||
{
|
||||
"title": "Cinema",
|
||||
@@ -319,20 +153,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "cinema",
|
||||
"form": [
|
||||
{
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"],
|
||||
"default": {
|
||||
"area": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["building_area", "address"]
|
||||
},
|
||||
{
|
||||
"title": "Hospital",
|
||||
@@ -344,25 +165,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "hospital",
|
||||
"form": [
|
||||
{
|
||||
"key": "emergency",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "building",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"],
|
||||
"default": {
|
||||
"area": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["emergency", "building_area", "address"]
|
||||
},
|
||||
{
|
||||
"title": "River",
|
||||
@@ -386,21 +189,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "highway-motorway",
|
||||
"form": [
|
||||
{
|
||||
"key": "oneway",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "maxspeed",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
"form": ["oneway", "access", "maxspeed"]
|
||||
},
|
||||
{
|
||||
"title": "Residential road",
|
||||
@@ -412,21 +201,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "highway-residential",
|
||||
"form": [
|
||||
{
|
||||
"key": "oneway",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "maxspeed",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
"form": ["oneway", "access", "maxspeed"]
|
||||
},
|
||||
{
|
||||
"title": "Primary Road",
|
||||
@@ -438,21 +213,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "highway-primary",
|
||||
"form": [
|
||||
{
|
||||
"key": "oneway",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "maxspeed",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
"form": ["oneway", "access", "maxspeed"]
|
||||
},
|
||||
{
|
||||
"title": "Secondary Road",
|
||||
@@ -464,21 +225,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "highway-secondary",
|
||||
"form": [
|
||||
{
|
||||
"key": "oneway",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "maxspeed",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
"form": ["oneway", "access", "maxspeed"]
|
||||
},
|
||||
{
|
||||
"title": "Tertiary Road",
|
||||
@@ -490,21 +237,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "highway-tertiary",
|
||||
"form": [
|
||||
{
|
||||
"key": "oneway",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "maxspeed",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
"form": ["oneway", "access", "maxspeed"]
|
||||
},
|
||||
{
|
||||
"title": "Service Road",
|
||||
@@ -516,21 +249,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "highway-service",
|
||||
"form": [
|
||||
{
|
||||
"key": "oneway",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "maxspeed",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
"form": ["oneway", "access", "maxspeed"]
|
||||
},
|
||||
{
|
||||
"title": "Rail",
|
||||
@@ -554,21 +273,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "highway-trunk",
|
||||
"form": [
|
||||
{
|
||||
"key": "oneway",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "maxspeed",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
"form": ["oneway", "access", "maxspeed"]
|
||||
},
|
||||
{
|
||||
"title": "Foot path",
|
||||
@@ -580,21 +285,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "highway-footway",
|
||||
"form": [
|
||||
{
|
||||
"key": "oneway",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "maxspeed",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
"form": []
|
||||
},
|
||||
{
|
||||
"title": "Cycle path",
|
||||
@@ -606,21 +297,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "highway-cycleway",
|
||||
"form": [
|
||||
{
|
||||
"key": "oneway",
|
||||
"type": "select",
|
||||
"options": ["yes", "no"]
|
||||
},
|
||||
{
|
||||
"key": "access",
|
||||
"type": "combo"
|
||||
},
|
||||
{
|
||||
"key": "maxspeed",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
"form": ["oneway", "access", "maxspeed"]
|
||||
},
|
||||
{
|
||||
"title": "Basketball court",
|
||||
@@ -633,12 +310,7 @@
|
||||
}
|
||||
},
|
||||
"icon": "basketball",
|
||||
"form": [
|
||||
{
|
||||
"key": "surface",
|
||||
"type": "combo"
|
||||
}
|
||||
]
|
||||
"form": ["surface"]
|
||||
},
|
||||
{
|
||||
"title": "Building",
|
||||
@@ -650,18 +322,6 @@
|
||||
}
|
||||
},
|
||||
"icon": "warehouse",
|
||||
"form": [
|
||||
{
|
||||
"key": "building",
|
||||
"type": "combo",
|
||||
"default": {
|
||||
"area": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "address",
|
||||
"title": "Address"
|
||||
}
|
||||
]
|
||||
"form": ["building", "address"]
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user