photomix/app/views/collections/index.html.erb

31 lines
1.2 KiB
Plaintext

<% @collections.in_groups_of(4).compact.each do |group| %>
<% unless group.compact.empty? %>
<ul class="thumbnails">
<% group.compact.each do |collection| %>
<% unless collection.albums.empty? %>
<% unless collection.albums.first.photos.empty? %>
<li class="span3">
<div class="thumbnail">
<%= image_tag collection.albums.first.photos.first.attachment.collection.url %>
<div class="caption">
<h5><%= collection.title %></h5>
<p><%= collection.description %></p>
<p><%= link_to 'View', (collection_path(collection) unless collection.albums.empty? || collection.albums.first.photos.empty?), {:class => 'btn btn-primary'} %></p>
</div>
</div>
</li>
<% end %>
<% end %>
<% end %>
</ul>
<% end %>
<% end %>
<%= content_for :action_links do %>
<% if current_user and current_user.has_role?("admin") %>
<%= link_to "New collection", new_collection_path %>
<% end %>
<% end %>