Commit 667fc50c4c029dc0b21246981f7b372d8d51e1b3

Authored by MoisesMachado
1 parent 6fb030d4

ActionItem354: fixed a problem on the definedness of simple_search local variabl…

…e on the _search_form.rhml and the hiding of the advanced options


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1845 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 27 additions and 12 deletions   Show diff stats
app/views/search/_search_form.rhtml
  1 +<% simple_search = false unless defined? simple_search %>
  2 +
1 <% form_tag( { :action => 'index', :category_path => ( @category ? @category.explode_path : [] ) }, 3 <% form_tag( { :action => 'index', :category_path => ( @category ? @category.explode_path : [] ) },
2 :method => 'get', :class => 'search_form' ) do %> 4 :method => 'get', :class => 'search_form' ) do %>
3 <%= '<h3>%s</h3>' % form_title if defined? form_title %> 5 <%= '<h3>%s</h3>' % form_title if defined? form_title %>
@@ -13,18 +15,31 @@ @@ -13,18 +15,31 @@
13 <% end %> 15 <% end %>
14 </div> 16 </div>
15 17
16 - <div class="search-options search-for" id='advanced-search-options' style="display: <%= simple_search ? 'none' : 'block' %>">  
17 - <h4><%= _('Search for:') %></h4>  
18 - <ul>  
19 - <% @search_in.map { |t,n| [t,gettext(n)] } .  
20 - sort_by(&:last).each do |thing, name| %>  
21 - <li>  
22 - <%= labelled_check_box name, 'find_in[]', thing.to_s, @searching[thing.to_sym] %>  
23 - </li>  
24 - <% end %>  
25 - </ul>  
26 - <br style="clear:both" />  
27 - </div><!-- fim class="search-options" --> 18 + <div id='advanced-search-options' style="display: <%= simple_search ? 'none' : 'block' %>">
  19 + <div class="search-options search-within">
  20 + <h4><%= _('Search within:') %></h4>
  21 + <br style='clear:left'/>
  22 + <div>
  23 + <label for="search-radius"><%= _('Distance: ') %></label><%= text_field_tag 'radius', '',:id => 'search-radius' %>
  24 + <label for="search_region"><%= _('From: ') %></label><%= text_field :region, :name, :id => 'search_region' %>
  25 + <div id='search_region_auto_complete' class='auto-complete'></div>
  26 + <%= auto_complete_field('search_region', :url => {:action => 'complete_region'}) %>
  27 + </div>
  28 + </div><!-- fim class="search-options" -->
  29 +
  30 + <div class="search-options search-for">
  31 + <h4><%= _('Search for:') %></h4>
  32 + <ul>
  33 + <% @search_in.map { |t,n| [t,gettext(n)] } .
  34 + sort_by(&:last).each do |thing, name| %>
  35 + <li>
  36 + <%= labelled_check_box name, 'find_in[]', thing.to_s, @searching[thing.to_sym] %>
  37 + </li>
  38 + <% end %>
  39 + </ul>
  40 + <br style="clear:both" />
  41 + </div><!-- fim class="search-options" -->
  42 + </div><!-- end id="advanced-search-options" -->
28 43
29 <% if simple_search %> 44 <% if simple_search %>
30 <%= link_to_function(_('Advanced search'), nil, :id => 'advanced_search_link') do |page| 45 <%= link_to_function(_('Advanced search'), nil, :id => 'advanced_search_link') do |page|