Control search API URL from uMap config

cf #842
This commit is contained in:
Yohan Boniface 2020-11-08 15:10:13 +01:00
parent ec275d64fe
commit 3927a845a4
2 changed files with 7 additions and 1 deletions

View file

@ -191,7 +191,8 @@ ENABLE_ACCOUNT_LOGIN = False
UMAP_ALLOW_ANONYMOUS = False UMAP_ALLOW_ANONYMOUS = False
UMAP_EXTRA_URLS = { UMAP_EXTRA_URLS = {
'routing': 'http://www.openstreetmap.org/directions?engine=osrm_car&route={lat},{lng}&locale={locale}#map={zoom}/{lat}/{lng}', # noqa 'routing': 'http://www.openstreetmap.org/directions?engine=osrm_car&route={lat},{lng}&locale={locale}#map={zoom}/{lat}/{lng}', # noqa
'ajax_proxy': '/ajax-proxy/?url={url}&ttl={ttl}' 'ajax_proxy': '/ajax-proxy/?url={url}&ttl={ttl}',
'search': 'https://photon.komoot.io/api/?',
} }
UMAP_KEEP_VERSIONS = 10 UMAP_KEEP_VERSIONS = 10
SITE_URL = "http://umap.org" SITE_URL = "http://umap.org"

View file

@ -891,6 +891,11 @@ L.U.LocateControl = L.Control.extend({
L.U.Search = L.PhotonSearch.extend({ L.U.Search = L.PhotonSearch.extend({
initialize: function (map, input, options) {
L.PhotonSearch.prototype.initialize.call(this, map, input, options);
this.options.url = map.options.urls.search;
},
onBlur: function (e) { onBlur: function (e) {
// Overrided because we don't want to hide the results on blur. // Overrided because we don't want to hide the results on blur.
this.fire('blur'); this.fire('blur');