]> git.openstreetmap.org Git - rails.git/blob - app/views/site/_search.rhtml
allow the user to pass in a gpx and a zoom
[rails.git] / app / views / site / _search.rhtml
1 <script type="text/javascript">
2 <!--
3   function startSearch() {
4     updateSidebar("Search Results", "<p class='search_results_entry'>Searching...<\/p>");
5
6     $("search_field").style.display = "none";
7     $("search_active").style.display = "inline";
8   }
9
10   function endSearch() {
11     $("search_field").style.display = "inline";
12     $("search_active").style.display = "none";
13   }
14
15   function describeLocation() {
16     var position = getPosition();
17
18     <%= remote_function(:loading => "startSearch()",
19                         :complete => "endSearch()",
20                         :url => { :controller => :geocoder, :action => :description },
21                         :with => "'lat=' + position.lat + '&lon=' + position.lon") %>
22   }
23
24   <% if params[:query] %>
25   <%= remote_function(:loading => "startSearch()",
26                       :complete => "endSearch()",
27                       :url => { :controller => :geocoder, :action => :search, :query => h(params[:query]) }) %>
28   <% end %>
29 // -->
30 </script>
31
32 <% content_for "optionals" do %>
33   <div class="optionalbox">
34     <span class="oboxheader">Search</span>
35     <span class="whereami"><a href="javascript:describeLocation()">Where am I?</a></span>
36     <div class="search_form">
37     <div id="search_field">
38     <% form_remote_tag(:loading => "startSearch()",
39                        :complete => "endSearch()",
40                        :url => { :controller => :geocoder, :action => :search }) do %>
41       <%= text_field_tag :query, h(params[:query]) %>
42       <%= submit_tag "Go" %>
43     <% end %>
44     </div>
45     <p id="search_active">Searching...</p>
46     </div>
47     <p class="search_help">
48       examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ',
49       or 'post offices near Lünen'
50       <a href="http://wiki.openstreetmap.org/index.php/Search">more examples...</a>
51     </p>
52   </div>
53 <% end %>