Replaced .count by .length to omit one SQL query.

Slightly rearranged the display.
This commit is contained in:
Christoph Haas 2013-08-08 22:39:39 +02:00
parent 110cd16d6e
commit df39fba0ba

View file

@ -1,12 +1,15 @@
<%# Show search results %>
<% if @packages.count>0 %>
<% if @packages.length>0 %>
<ul>
<% @packages.each do |package| %>
<h2><%= package.name %></h2>
<li>
<%= package.name %>
(<%= package.description %>)
<% if package.screenshots.length>0 %>
<%= image_tag package.screenshots.first.image_url('small') %>
<% else %>
<em>No screenshot. :( Care to upload one?</em>
<% end %>
</li>
<% end %>