docbrown/app/views/articles/_collection.html.erb
2018-10-29 13:04:42 -04:00

20 lines
802 B
Text

<% @collection = @article.collection %>
<% if @collection.present? && @collection.articles.where(published: true).size > 1 %>
<div class="article-collection-wrapper article-collection-wrapper-<%= position %>">
<% if @collection.slug.present? %>
<p>Part of "<%= @collection.slug %>" series</p>
<% else %>
<p>Part of a series</p>
<% end %>
<div class="article-collection">
<% @collection.articles.where(published: true).order("published_at ASC").each_with_index do |article,i| %>
<a
href="<%= article.path if article.published %>"
class="<%= collection_link_class(@article,article) %>"
data-preload-image="<%=cloud_cover_url(article.main_image) %>"
>
</a>
<% end %>
</div>
</div>
<% end %>