]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/search.js
Pass editing params through to welcome page
[rails.git] / app / assets / javascripts / index / search.js
index 486c9b36bbc521f3551635c34a755141365bd235..2f92e6282ec45fa49f13e3f4bd0e9bd4d8577428 100644 (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);    
+  }
 }