More search improvements - a "Where am I?" link that does a reverse
[rails.git] / app / views / site / _search.rhtml
index aa9294236e10e65a1b298127363ae1aad26c15f3..14f8fa5f60714f155ec6bc3fb56d452e93b2a0ba 100644 (file)
@@ -12,6 +12,7 @@
 <script type="text/javascript">
 <!--
   function startSearch() {
+    $("search_results_content").innerHTML = "<p class='search_results_entry'>Searching...</p>";
     $("search_field").style.display = "none";
     $("search_active").style.display = "inline";
   }
     <%= onclose %>
   }
 
+  function describeLocation() {
+    var position = getPosition();
+
+    <%= remote_function(:loading => "startSearch()",
+                        :complete => "endSearch()",
+                        :url => { :controller => :geocoder, :action => :description },
+                        :with => "'lat=' + position.lat + '&lon=' + position.lon") %>
+  }
+
   <% if params[:query] %>
   <%= remote_function(:loading => "startSearch()",
                       :complete => "endSearch()",
@@ -42,6 +52,7 @@
 <% content_for "optionals" do %>
   <div class="optionalbox">
     <span class="oboxheader">Search</span>
+    <span class="whereami"><a href="javascript:describeLocation()">Where am I?</a></span>
     <div class="search_form">
     <span id="search_field">
     <% form_remote_tag(:loading => "startSearch()",