Show a message when no features are found
This commit is contained in:
parent
e329bf37c0
commit
dedd87da28
3 changed files with 15 additions and 4 deletions
|
@ -20,17 +20,17 @@ OSM.Query = function(map) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#sidebar_content")
|
$("#sidebar_content")
|
||||||
.on("mouseover", ".query-results li", function () {
|
.on("mouseover", ".query-results li.query-result", function () {
|
||||||
var geometry = $(this).data("geometry")
|
var geometry = $(this).data("geometry")
|
||||||
if (geometry) map.addLayer(geometry);
|
if (geometry) map.addLayer(geometry);
|
||||||
$(this).addClass("selected");
|
$(this).addClass("selected");
|
||||||
})
|
})
|
||||||
.on("mouseout", ".query-results li", function () {
|
.on("mouseout", ".query-results li.query-result", function () {
|
||||||
var geometry = $(this).data("geometry")
|
var geometry = $(this).data("geometry")
|
||||||
if (geometry) map.removeLayer(geometry);
|
if (geometry) map.removeLayer(geometry);
|
||||||
$(this).removeClass("selected");
|
$(this).removeClass("selected");
|
||||||
})
|
})
|
||||||
.on("click", ".query-results li", function (e) {
|
.on("click", ".query-results li.query-result", function (e) {
|
||||||
if (!$(e.target).is('a')) {
|
if (!$(e.target).is('a')) {
|
||||||
$(this).find("a").simulate("click", e);
|
$(this).find("a").simulate("click", e);
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,7 @@ OSM.Query = function(map) {
|
||||||
|
|
||||||
if (interestingFeature(element, latlng)) {
|
if (interestingFeature(element, latlng)) {
|
||||||
var $li = $("<li>")
|
var $li = $("<li>")
|
||||||
|
.addClass("query-result")
|
||||||
.data("geometry", featureGeometry(element, nodes))
|
.data("geometry", featureGeometry(element, nodes))
|
||||||
.appendTo($ul);
|
.appendTo($ul);
|
||||||
var $p = $("<p>")
|
var $p = $("<p>")
|
||||||
|
@ -175,6 +176,12 @@ OSM.Query = function(map) {
|
||||||
.appendTo($p);
|
.appendTo($p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ul.find("li").length == 0) {
|
||||||
|
$("<li>")
|
||||||
|
.text(I18n.t("javascripts.query.nothing_found"))
|
||||||
|
.appendTo($ul);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1140,7 +1140,10 @@ header .search_form {
|
||||||
li {
|
li {
|
||||||
padding: 15px 20px;
|
padding: 15px 20px;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
cursor: pointer;
|
|
||||||
|
&.query-result {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
&.selected {
|
&.selected {
|
||||||
background: #FFFFE6;
|
background: #FFFFE6;
|
||||||
|
|
|
@ -2125,6 +2125,7 @@ en:
|
||||||
node: Node
|
node: Node
|
||||||
way: Way
|
way: Way
|
||||||
relation: Relation
|
relation: Relation
|
||||||
|
nothing_found: No features found
|
||||||
redaction:
|
redaction:
|
||||||
edit:
|
edit:
|
||||||
description: "Description"
|
description: "Description"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue