]> git.openstreetmap.org Git - rails.git/blob - app/views/site/_search.rhtml
Back out attempt to commit partial support for POIs as this is not at
[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     <span 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     <% end %>
43     </span>
44     <p id="search_active">Searching...</p>
45     </div>
46     <p class="search_help">
47       examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ',
48       or 'post offices near Lünen'
49       <a href="http://wiki.openstreetmap.org/index.php/Search">more examples...</a>
50     </p>
51   </div>
52 <% end %>