Fix the "Where am I?" link

This commit is contained in:
Tom Hughes 2013-08-07 08:42:57 +01:00
parent acf419d000
commit 258e66299a
2 changed files with 16 additions and 16 deletions

View file

@ -1,5 +1,6 @@
function initializeSearch(map) {
$("#search_form").submit(submitSearch);
$("#describe_location").click(describeLocation);
if ($("#query").val()) {
$("#search_form").submit();
@ -58,4 +59,18 @@ function initializeSearch(map) {
map.addObject(data, { zoom: false, style: { opacity: 0.2, fill: false } });
}
}
function describeLocation(e) {
e.preventDefault();
var center = map.getCenter(),
zoom = map.getZoom();
$("#sidebar_title").html(I18n.t('site.sidebar.search_results'));
$("#sidebar_content").load($(this).attr("href"), {
lat: center.lat,
lon: center.lng,
zoom: zoom
}, openSidebar);
}
}