_display_results.rhtml 1.83 KB
<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" -->