[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH] Cosmetic modifications
From: |
Pierre Mauduit |
Subject: |
[Maposmatic-dev] [PATCH] Cosmetic modifications |
Date: |
Mon, 21 Dec 2009 23:21:21 +0100 |
From: Pierre Mauduit <address@hidden>
- No printing of "No results found" in case of unusable results
found with nominatim
- Filter admin_level = 6 while nominatim search
---
www/templates/maposmatic/index.html | 35 +++++++++++++++++++++--------------
1 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/www/templates/maposmatic/index.html
b/www/templates/maposmatic/index.html
index 4830116..a87ccd4 100644
--- a/www/templates/maposmatic/index.html
+++ b/www/templates/maposmatic/index.html
@@ -85,7 +85,8 @@ function pageinit()
});
}
-var elemFound = 0 ;
+var elemFound = 0;
+var unusableToken = 0;
function toggle_form_validation(enableForm)
{
@@ -116,6 +117,7 @@ function validate_city_search()
var searchPat = $("#id_administrative_city").attr("value") ;
elemFound = 0;
+ unusableToken = 0;
$.getJSON("/nominatim/" + searchPat,
function(data){
@@ -123,28 +125,34 @@ function validate_city_search()
$.each(data, function(i,item){
- if (typeof item.ocitysmap_params == "undefined")
+ if (typeof item.ocitysmap_params != "undefined")
{
- $("#result_nominatim_search").append("<li><img
src=\"/smedia/icon_alert.png\" "+
- "alt=\"Work In Progress\" title=\"{% trans "This place could
not be rendered by MapOSMatic, see help to figure out why." %}\" />"+
- " <label class=\"place_unavailable\""
- + ">" +item.display_name + "</label></li>");
+ if (item.ocitysmap_params['admin_level'] == 8)
+ {
+ $("#result_nominatim_search").append("<li><input
onchange=\"javascript:update_hidden(this,'"
+ +item.display_name+"'); select_country('" +
item.country_code + "');\" type=\"radio\" name=\"administrative_tmp_osmid\"
value=\""
+ +item.ocitysmap_params['id']+"\"
id=\"rd"+item.ocitysmap_params['id']+"\"/><label for=\"rd"+
+ item.ocitysmap_params['id']+"\">"
+item.display_name+"</label></li>");
+
+ elemFound = elemFound + 1;
+ }
}
+
else
{
- $("#result_nominatim_search").append("<li><input
onchange=\"javascript:update_hidden(this,'"
- +item.display_name+"'); select_country('" +
item.country_code + "');\" type=\"radio\" name=\"administrative_tmp_osmid\"
value=\""
- +item.ocitysmap_params['id']+"\"
id=\"rd"+item.ocitysmap_params['id']+"\"/><label for=\"rd"+
- item.ocitysmap_params['id']+"\">"
+item.display_name+"</label></li>");
- elemFound = elemFound + 1;
+ $("#result_nominatim_search").append("<li><img
src=\"/smedia/icon_alert.png\" "+
+ "alt=\"Work In Progress\" title=\"{% trans "This place
could not be rendered by MapOSMatic, see help to figure out why." %}\" />"+
+ " <label class=\"place_unavailable\""
+ + ">" +item.display_name + "</label></li>");
+ unusableToken = unusableToken + 1;
}
});
if (elemFound == 0)
{
toggle_form_validation("false");
- $("#result_nominatim_search").empty();
- $("#result_nominatim_search").append("<li><b>{% trans 'No
results found.' %}</b></li>");
+ if (unusableToken == 0)
+ $("#result_nominatim_search").append("<li><b>{% trans 'No
results found.' %}</b></li>");
}
});
}
@@ -275,7 +283,6 @@ maps.{% endblocktrans %}</p>
</td></tr>
<tr class="byadmin field">
<td colspan="2">
- {% trans "Did you mean : " %}
<ul id="result_nominatim_search">
</ul>
</td>
--
1.6.5.7
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Maposmatic-dev] [PATCH] Cosmetic modifications,
Pierre Mauduit <=