diff app/views/search/index.rhtml @ 498:87bfac1079fd bug_94

If a search matches any project titles (and projects are in scope for the search), show those projects separately at the start of the search results provided there are no more than 5 of them (further fix to bug #94)
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 13 Jul 2011 12:45:24 +0100
parents 1333582e34c4
children 85fd403a7daa
line wrap: on
line diff
--- a/app/views/search/index.rhtml	Tue Mar 29 11:13:50 2011 +0100
+++ b/app/views/search/index.rhtml	Wed Jul 13 12:45:24 2011 +0100
@@ -18,6 +18,16 @@
 <% end %>
 </div>
 
+<% if @project_matches and !@project_matches.empty? and (@project_matches.count < 6) and !@pagination_previous_date %>
+   <h3><%= l(:label_matching_project_plural) %> (<%= @project_matches.count %>)</h3>
+    <dl id="search-results">
+      <% @project_matches.each do |e| %>
+        <dt class="<%= e.event_type %>"><%= content_tag('span', h(e.project), :class => 'project') unless @project == e.project %> <%= link_to highlight_tokens(truncate(e.event_title, :length => 255), @tokens), e.event_url %></dt>
+        <dd><span class="description"><%= e.short_description %></span>
+      <% end %>
+    </dl>
+<% end %>
+
 <% if @results %>
     
     <h3><%= l(:label_result_plural) %> (<%= @results_by_type.values.sum %>)</h3>