Commit 7a67c87def39f6f7218aff4ccc21f1cb45dfbb43

Authored by AntonioTerceiro
1 parent 1821a739

ActionItem313: including full search options in search results page


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1696 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/public/search_controller.rb
... ... @@ -5,11 +5,16 @@ class SearchController < ApplicationController
5 5 before_filter :load_category
6 6 before_filter :prepare_filter
7 7 before_filter :check_search_whole_site
  8 + before_filter :load_search_assets
8 9  
9 10 no_design_blocks
10 11  
11 12 protected
12 13  
  14 + def load_search_assets
  15 + @search_in = SEARCH_IN
  16 + end
  17 +
13 18 def search(finder, query)
14 19 finder.find_by_contents(query).sort_by do |hit|
15 20 -(relevance_for(hit))
... ... @@ -106,7 +111,6 @@ class SearchController < ApplicationController
106 111 #######################################################
107 112  
108 113 def popup
109   - @search_in = SEARCH_IN
110 114 render :action => 'popup', :layout => false
111 115 end
112 116  
... ...
app/views/search/_display_results.rhtml
1   -<div id='new-search'>
2   -<% form_tag(:action => 'index') do %>
3   - <%= text_field_tag 'query', @query %>
4   - <%= submit_button :search, _('Search') %>
5   -<% end %>
  1 +<%= render :partial => 'search_form' %>
6 2  
  3 +<div>
7 4 <%= link_to _('Search for "%s" in the whole site') % @query, :controller => 'search', :action => 'index', :category_path => [], :query => @query if @category %>
8 5 </div>
9 6  
... ...
app/views/search/popup.rhtml
... ... @@ -2,50 +2,7 @@
2 2  
3 3 <h2><%= _('Search %s') % @environment.name %></h2>
4 4  
5   -<% form_tag({:action => 'index', :category_path => (@category ? @category.explode_path : [])}, :method => 'get') do%>
6   -
7   - <div class="search-field">
8   - <span class="formfield">
9   - <%= text_field_tag 'query', '', :id => 'popup-search-input', :size => 50 %>
10   - <%= javascript_tag '$("popup-search-input").focus()' %>
11   - </span>
12   - <%= submit_button(:search, _('Search')) %>
13   - </div>
14   -
15   - <% if @category %>
16   - <h3><%= _('Search in:') %></h3>
17   - <ul>
18   - <li>
19   - <%= radio_button_tag :search_whole_site, 'no', true %>
20   - <span><%= _('Only in %{category}') % { :category => @category.full_name } %></span>
21   - </li>
22   - <li>
23   - <%= radio_button_tag :search_whole_site, 'yes' %>
24   - <span><%= _('Whole site') %></span>
25   - </li>
26   - </ul>
27   - <% end %>
28   -
29   - <div class="search-options">
30   - <h3><%= _('Search for:') %></h3>
31   - <ul>
32   - <% @search_in.map { |t,n| [t,gettext(n)] } .
33   - sort_by(&:last).each do |thing, name| %>
34   - <li>
35   - <%= check_box_tag 'find_in[]', thing.to_s, true %>
36   - <span><%= name %></span>
37   - </li>
38   - <% end %>
39   - </ul>
40   - <br style="clear:both" />
41   - </div><!-- fim class="search-options" -->
42   -
43   - <% button_bar do %>
44   - <%= submit_button(:search, _('Search')) %>
45   - <%= lightbox_close_button(_('Close')) %>
46   - <% end %>
47   -
48   -<% end %>
  5 +<%= render :partial => 'search_form' %>
49 6  
50 7 <script type='text/javascript'>
51 8 $('query').focus();
... ...
public/stylesheets/search.css
... ... @@ -28,30 +28,30 @@
28 28 text-align: center;
29 29 }
30 30  
31   -#search-popup .search-options ul,
32   -#search-popup .search-options li {
  31 +.search-options ul,
  32 +.search-options li {
33 33 margin: 0px;
34 34 padding: 0px;
35 35 list-style: none;
36 36 }
37   -#search-popup .search-options ul {
  37 +.search-options ul {
38 38 clear: left;
39 39 }
40 40  
41   -#search-popup .search-options {
  41 +.search-options {
42 42 border: 1px solid #2A5896;
43 43 padding: 0px 0px 5px 20px;
44 44 margin-top: 20px;
45 45 }
46 46  
47   -#search-popup .search-options h3 {
  47 +.search-options h3 {
48 48 float: left;
49 49 margin: -10px 0px 0px 0px;
50 50 background: #FFF;
51 51 padding: 0px 5px;
52 52 }
53 53  
54   -#search-popup .search-options li {
  54 +.search-options li {
55 55 float: left;
56 56 width: 33%;
57 57 padding: 2px 0px;
... ...