1 <script type="text/javascript">
3 function startSearch() {
4 updateSidebar("Search Results", "<p class='search_results_entry'>Searching...</p>");
6 $("search_field").style.display = "none";
7 $("search_active").style.display = "inline";
10 function endSearch() {
11 $("search_field").style.display = "inline";
12 $("search_active").style.display = "none";
15 function describeLocation() {
16 var position = getPosition();
18 <%= remote_function(:loading => "startSearch()",
19 :complete => "endSearch()",
20 :url => { :controller => :geocoder, :action => :description },
21 :with => "'lat=' + position.lat + '&lon=' + position.lon") %>
24 <% if params[:query] %>
25 <%= remote_function(:loading => "startSearch()",
26 :complete => "endSearch()",
27 :url => { :controller => :geocoder, :action => :search, :query => h(params[:query]) }) %>
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 <%= submit_tag "Go" %>
45 <p id="search_active">Searching...</p>
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>