_display_results.rhtml
2.82 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<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
%>
<% @order.each do |name| %>
<% results = @results[name] %>
<%
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] %>
</h3>
<% end %>
<%# FIXME: don't hardcode an asset like this %>
<% if name == :most_commented_articles %>
<%= link_to( results.respond_to?(:total_entries) ? _('see all (%d)') % results.total_entries : _('see all...'),
params.merge(:action => 'index',
:asset => 'articles' ),
:class => 'see-more' ) if @results.size > 1 %>
<% else %>
<%= link_to( results.respond_to?(:total_entries) ? _('see all (%d)') % results.total_entries : _('see all...'),
params.merge(:action => 'index',
:asset => name ),
:class => 'see-more' ) if @results.size > 1 %>
<% 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' %>">
<div class="search-results-innerbox2"><!-- the innerbox2 is a workarround for MSIE -->
<ul>
<% hit_pos = 0 %>
<% results.each do |hit| %>
<% next if hit.respond_to?(:visible) && !hit.visible? %>
<%= render :partial => partial_for_class(hit.class),
:object => hit,
:locals => { :pos => ( hit_pos += 1 ) } %>
<% end %>
</ul>
<hr />
</div><!-- end class="search-results-innerbox2" -->
</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" -->