Better use of Rails' tag helpers. Added list view.

This commit is contained in:
Christoph Haas 2013-08-25 23:38:50 +02:00
parent 869b87bc7b
commit e3e1871a8f
4 changed files with 63 additions and 24 deletions

View file

@ -0,0 +1,32 @@
<% # Show search results - grid style %>
<% if @packages.length>0 %>
<% @packages.each do |package| %>
<div class="col-md-3 col-sm-4">
<div class="thumbnail">
<% if package.screenshots.length>0 %>
<% screenshot = package.screenshots.first %>
<div style="text-align: center; height: 120px">
<%= link_to image_tag(screenshot.image_url('small')),
screenshot.image_url('large'),
:class => 'fancybox thumbnail',
:title => (
"#{package.description}" +
(screenshot.description.blank? ? '' : " (#{screenshot.description})")
)
%>
</div>
<h3><%= package.name %></h3>
<p><%= package.description %></p>
<% else %>
<div style="text-align: center; height: 120px">
<%= link_to image_tag("/thumbnail-404.png"),
"/path/to/upload/package" %>
</div>
<h3><%= package.name %></h3>
<p><%= package.description %></p>
<% end %>
</div>
</div>
<% end %>
<% end %>