Add example to custom url template prompt

(closes #3887)
This commit is contained in:
Bryan Housel
2017-06-20 00:38:49 -04:00
parent 684de28998
commit eff9aaeceb
4 changed files with 5 additions and 4 deletions

2
API.md
View File

@@ -19,7 +19,7 @@ in the hash portion of the URL:
where the URL can contain the standard tile URL placeholders `{x}`, `{y}` and
`{z}`/`{zoom}`, `{ty}` for flipped TMS-style Y coordinates, and `{switch:a,b,c}` for
DNS multiplexing. Example:
`background=custom:http://{switch:a,b,c}.tiles.mapbox.com/v4/examples.map-4l7djmvo/{z}/{x}/{y}.png`
`background=custom:https://{switch:a,b,c}.tiles.mapbox.com/v4/examples.map-4l7djmvo/{zoom}/{x}/{y}.png`
* `gpx` - A custom URL for loading a gpx track. Specifying a `gpx` parameter will
automatically enable the gpx layer for display. Example:
`gpx=https://tasks.hotosm.org/project/592/task/16.gpx`

View File

@@ -347,7 +347,7 @@ en:
switch: Switch back to this background
custom: Custom
custom_button: Edit custom background
custom_prompt: "Enter a tile URL template. Valid tokens are {zoom}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme."
custom_prompt: "Enter a tile URL template. Valid tokens are {zoom}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.\n\nExample:\n{example}"
fix_misalignment: Adjust imagery offset
imagery_source_faq: Where does this imagery come from?
reset: reset

View File

@@ -431,7 +431,7 @@
"switch": "Switch back to this background",
"custom": "Custom",
"custom_button": "Edit custom background",
"custom_prompt": "Enter a tile URL template. Valid tokens are {zoom}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.",
"custom_prompt": "Enter a tile URL template. Valid tokens are {zoom}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.\n\nExample:\n{example}",
"fix_misalignment": "Adjust imagery offset",
"imagery_source_faq": "Where does this imagery come from?",
"reset": "reset",

View File

@@ -111,7 +111,8 @@ export function uiBackground(context) {
function editCustom() {
d3.event.preventDefault();
var template = window.prompt(t('background.custom_prompt'), customTemplate);
var example = 'https://{switch:a,b,c}.tiles.mapbox.com/v4/examples.map-4l7djmvo/{zoom}/{x}/{y}.png';
var template = window.prompt(t('background.custom_prompt', { example: example }), customTemplate);
if (template) {
setCustom(template);
} else {