[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH 2/5] Add a no results note when the suggestion b
From: |
Maxime Petazzoni |
Subject: |
[Maposmatic-dev] [PATCH 2/5] Add a no results note when the suggestion box has no results to show. |
Date: |
Mon, 11 Jan 2010 11:02:53 +0100 |
---
www/media/osm_map.js | 27 ++++++++++++++++-----------
www/media/style.css | 7 ++++---
www/templates/maposmatic/new.html | 2 ++
3 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/www/media/osm_map.js b/www/media/osm_map.js
index f4cc92f..52424c9 100644
--- a/www/media/osm_map.js
+++ b/www/media/osm_map.js
@@ -142,7 +142,7 @@ function suggest(input, results, osm_id, button, options) {
var timeout = false;
var shown = false;
- closeSuggest();
+ closeSuggest(true);
// Setup the keyup event.
$input.keyup(processKey);
@@ -161,21 +161,26 @@ function suggest(input, results, osm_id, button, options)
{
}
/* Empty and close the suggestion box. */
- function closeSuggest() {
+ function closeSuggest(hide) {
$results.empty();
- $results.hide();
- shown = false;
+
+ if (hide)
+ $results.hide();
+ else
+ $results.show();
+
+ shown = !hide;
}
/* Handle the JSON result. */
function handleNominatimResults(data, textResult) {
var unusable_token = false;
$(input).css('cursor', 'text');
- closeSuggest();
+ closeSuggest(false);
- if (data.length) {
- $results.show();
- shown = true;
+ if (!data.length) {
+ $results.append('<li class="info">' + $('#noresultsinfo').html() +
'</li>');
+ return;
}
$.each(data, function(i, item) {
@@ -195,7 +200,7 @@ function suggest(input, results, osm_id, button, options) {
function doQuery() {
if (!$input.val().length) {
- closeSuggest();
+ closeSuggest(true);
return;
}
$(input).css('cursor', 'wait');
@@ -212,7 +217,7 @@ function suggest(input, results, osm_id, button, options) {
switch (e.keyCode) {
case 27: // ESC
- closeSuggest();
+ closeSuggest(true);
break;
case 9: // TAB
case 13: // OK
@@ -254,7 +259,7 @@ function suggest(input, results, osm_id, button, options) {
$osm_id.val(temp[2]);
$input.val(elt.html());
- closeSuggest();
+ closeSuggest(true);
setFormActivation(true);
}
diff --git a/www/media/style.css b/www/media/style.css
index c32b8e6..60be242 100644
--- a/www/media/style.css
+++ b/www/media/style.css
@@ -374,8 +374,7 @@ a.selectedletter {
}
#suggest li.info {
- color: #ccc;
- padding: 0.5em 0 2px 3px;
+ color: #bbb;
font-size: 8pt;
}
@@ -406,6 +405,8 @@ ul.errorlist {
color: red;
}
-#noadminlimitinfo {
+#noadminlimitinfo,
+#noresultsinfo {
display: none;
}
+
diff --git a/www/templates/maposmatic/new.html
b/www/templates/maposmatic/new.html
index dae8ee4..05dcac6 100644
--- a/www/templates/maposmatic/new.html
+++ b/www/templates/maposmatic/new.html
@@ -102,7 +102,9 @@ map.{% endblocktrans %}
</td></tr>
</table>
</form>
+
<span id="noadminlimitinfo">{% blocktrans %}Wondering why you can't choose
some of these results?<br />Their administrative boundaries are missing from
the OSM database.<br />Look at the <a
href="http://wiki.maposmatic.org/doku.php?id=faq">FAQ</a> for more details.{%
endblocktrans %}</span>
+<span id="noresultsinfo">{% trans "No results." %}</span>
{% endblock %}
--
1.6.3.3.261.g85c6
Re: [Maposmatic-dev] [PATCH 1/5] Fix jobinfo table width, Thomas Petazzoni, 2010/01/11