Fix inline tag help for fields that handle multiple tags

Some preset fields like the access-restriction field manage
multiple tags at once (access=*, foot=*, bicycle=*, …). Then
iD wasn't able to show inline help when clicking the ⓘ button.

This introduces a new parameter for these kind of fields:
`referenceKey` determines the tag key which should be used to
search taginfo documentation for.

Fixes #2222.
This commit is contained in:
Martin Raifer
2014-05-11 20:55:41 +02:00
parent fee1ce7443
commit 4261fefc6e
5 changed files with 10 additions and 1 deletions
+2
View File
@@ -7,6 +7,7 @@
"bicycle",
"horse"
],
"referenceKey": "access",
"type": "access",
"label": "Access",
"placeholder": "Unknown",
@@ -65,6 +66,7 @@
"addr:city",
"addr:postcode"
],
"referenceKey": "addr",
"icon": "address",
"universal": true,
"label": "Address",
+1
View File
@@ -1,5 +1,6 @@
{
"keys": ["access", "foot", "motor_vehicle", "bicycle", "horse"],
"referenceKey": "access",
"type": "access",
"label": "Access",
"placeholder": "Unknown",
+1
View File
@@ -6,6 +6,7 @@
"addr:city",
"addr:postcode"
],
"referenceKey": "addr",
"icon": "address",
"universal": true,
"label": "Address",
+4
View File
@@ -14,6 +14,10 @@
"type": "string"
}
},
"referenceKey": {
"description": "Tag key which should be used to get taginfo documentation for (to be used when a field manages multiple tags)",
"type": "string"
},
"type": {
"description": "Type of field",
"type": "string",
+2 -1
View File
@@ -134,7 +134,8 @@ iD.ui.preset = function(context) {
return field.present();
})
.each(function(field) {
var reference = iD.ui.TagReference({key: field.key});
var key = field.referenceKey || field.key,
reference = iD.ui.TagReference({key: key});
if (state === 'hover') {
reference.showing(false);