X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a1af4d5de13e8a2094089453cbae6478739bd2c8..2fa422578448314fb6fad888b5c47cf994cb0b8c:/app/assets/javascripts/index/search.js diff --git a/app/assets/javascripts/index/search.js b/app/assets/javascripts/index/search.js index 486c9b36b..2f92e6282 100644 --- a/app/assets/javascripts/index/search.js +++ b/app/assets/javascripts/index/search.js @@ -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); + } }