[search] Better feedback when nothing can be found
This commit is contained in:
parent
4d6a7df596
commit
4808f4469c
@ -50,7 +50,7 @@ window.search.Query.prototype.init = function() {
|
|||||||
|
|
||||||
this.list = $('<ul>')
|
this.list = $('<ul>')
|
||||||
.appendTo(this.container)
|
.appendTo(this.container)
|
||||||
.append($('<li>').text('No results'));
|
.append($('<li>').text(this.confirmed ? 'No local results, searching online...' : 'No local results.'));
|
||||||
|
|
||||||
this.container.accordion({
|
this.container.accordion({
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
@ -272,6 +272,15 @@ addHook('search', function(query) {
|
|||||||
if(!query.confirmed) return;
|
if(!query.confirmed) return;
|
||||||
|
|
||||||
$.getJSON(NOMINATIM + encodeURIComponent(query.term), function(data) {
|
$.getJSON(NOMINATIM + encodeURIComponent(query.term), function(data) {
|
||||||
|
if(data.length == 0) {
|
||||||
|
query.addResult({
|
||||||
|
title: 'No results on OpenStreetMap',
|
||||||
|
icon: '//www.openstreetmap.org/favicon.ico',
|
||||||
|
onSelected: function() {return true;},
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
data.forEach(function(item) {
|
data.forEach(function(item) {
|
||||||
var result = {
|
var result = {
|
||||||
title: item.display_name,
|
title: item.display_name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user