1 <script type="text/javascript">
3 function startSearch() {
4 updateSidebar("<%= t 'site.sidebar.search_results' %>", "");
7 function describeLocation() {
8 var position = getPosition();
11 <%= remote_function(:loading => "startSearch()",
12 :url => { :controller => :geocoder, :action => :description },
13 :with => "'lat=' + position.lat + '&lon=' + position.lon + '&zoom=' + zoom") %>
16 function setSearchViewbox() {
17 <% if params[:action] == 'index' %>
18 var extent = getMapExtent();
20 $("minlon").value = extent.left;
21 $("minlat").value = extent.bottom;
22 $("maxlon").value = extent.right;
23 $("maxlat").value = extent.top;
27 <% if params[:query] %>
28 <%= remote_function(:loading => "startSearch()",
29 :url => { :controller => :geocoder, :action => :search, :query => h(params[:query]) }) %>
34 <% content_for "optionals" do %>
35 <div class="optionalbox">
36 <span class="oboxheader"><%= t 'site.search.search' %></span>
37 <span class="whereami"><a href="javascript:describeLocation()" title="<%= t 'site.search.where_am_i_title' %>"><%= t 'site.search.where_am_i' %></a></span>
38 <div class="search_form">
39 <div id="search_field">
40 <% form_remote_tag(:before => "setSearchViewbox()",
41 :loading => "startSearch()",
42 :complete => "endSearch()",
43 :url => { :controller => :geocoder, :action => :search },
44 :html => { :method => "get", :action => url_for(:action => "index") }) do %>
45 <%= text_field_tag :query, h(params[:query]) %>
46 <% if params[:action] == 'index' %>
47 <%= hidden_field_tag :minlon %>
48 <%= hidden_field_tag :minlat %>
49 <%= hidden_field_tag :maxlon %>
50 <%= hidden_field_tag :maxlat %>
52 <%= submit_tag t('site.search.submit_text') %>
56 <p class="search_help">
57 <%= t 'site.search.search_help' %>