_display_results.rhtml
1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<div id="search-results" class="<%= 'only-one-result-box' if @results.size == 1 %>">
<%
pos2 = :odd # allow to format in a two columns layout
pos3 = 3 # allow to format in a thre columns layout
%>
<% @results.each do |name,results| %>
<%
pos3 += 1; pos3 = 1 if pos3 > 3
pos2==:odd ? pos2=:even : pos2=:odd
%>
<% if !results.nil? and !results.empty? %>
<div class="search-results-<%= name %> search-results-box <%= pos2 %> <%= 'col%s_of3' % pos3.to_s %>">
<% if @controller.action_name != 'assets' %>
<% if @results.size != 1 %>
<h3>
<%= @names[name] %>
<%= icon_button :more, _('more...'), params.merge(:action => 'index', :find_in => [ name ]) %>
</h3>
<% end %>
<% end %>
<% partial = partial_for_class results.first.class %>
<div class="search-results-innerbox search-results-type-<%= partial %> <%= 'common-profile-list-block' if partial == 'profile' %>">
<ul>
<% results.each do |hit| %>
<%= render :partial => partial, :object => hit %>
<% end %>
</ul>
<hr />
</div><!-- end class="search-results-innerbox" -->
</div><!-- end class="search-results-<%= name %>" -->
<% else %>
<div class="search-results-<%= name %> search-results-empty search-results-box <%= pos2 %> <%= 'col%s_of3' % pos3.to_s %>">
<% if @controller.action_name != 'assets' %>
<% if @results.size != 1 %>
<h3><%= @names[name] %></h3>
<% end %>
<% end %>
<div class="search-results-innerbox search-results-type-empty">
<div> <%= _('None') %> </div>
<hr />
</div><!-- end class="search-results-innerbox" -->
</div><!-- end class="search-results-<%= name %>" -->
<% end %>
<% end %>
<br style="clear:both" />
</div><!-- end id="search-results" -->