Nominatim returns some search results that are not appropriate for MaOSMatic because they do not have an administrative boundary. We show those results so that users aren't confused, but we also display a message explaining why those results can't be used. This commit implements this message.
Instead of putting the message in the Javascript, which would require interfacing the Javascript code with the Django translation/locale system, the message is stored in an hidden <span> element in the HTML code (and is therefore translated like all the rest of the HTML text by the Django translation infrastructure). This message is copied by the Javascript code at the right place when needed. We were already doing the same thing for the #noresultsinfo message. Signed-off-by: Thomas Petazzoni <[email protected]> --- www/media/css/newmap.css | 3 +++ www/media/js/newmap.js | 2 +- www/templates/maposmatic/new.html | 1 + 3 files changed, 5 insertions(+), 1 deletions(-) diff --git a/www/media/css/newmap.css b/www/media/css/newmap.css index d6783bb..35b3081 100644 --- a/www/media/css/newmap.css +++ b/www/media/css/newmap.css @@ -35,6 +35,9 @@ display: none; } +#noadminboundary { + display: none; +} /* Wizard step list */ ul#steplist { diff --git a/www/media/js/newmap.js b/www/media/js/newmap.js index 3d5f44c..ed789fb 100644 --- a/www/media/js/newmap.js +++ b/www/media/js/newmap.js @@ -437,7 +437,7 @@ function suggest(input, results, osm_id, options) { } if (unusable_token) - $results.append('<li class="info">TODO</li>'); + $results.append('<li class="info">' + $('#noadminboundary').html() + '</li>'); } function doQuery(excludes) { diff --git a/www/templates/maposmatic/new.html b/www/templates/maposmatic/new.html index 6fe925c..61410a0 100644 --- a/www/templates/maposmatic/new.html +++ b/www/templates/maposmatic/new.html @@ -110,6 +110,7 @@ {{ form.administrative_osmid.errors }} {{ form.administrative_city.errors }} <span id="noresultsinfo">{% trans "No results." %}</span> + <span id="noadminboundary">{% trans "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." %}</span> </div> </div> -- 1.7.4.1
