bouquins-ror/app/views/series/_index.html.erb

36 lines
803 B
Plaintext
Raw Normal View History

<%= render'layouts/initials' %>
2015-06-29 17:51:55 +00:00
<%= will_paginate class: "center" %>
2015-06-29 16:58:02 +00:00
2015-06-29 17:51:55 +00:00
<table class="table table-striped series">
<tr>
<th>Name</th>
<th>Authors</th>
<th>Books</th>
</tr>
2015-06-29 16:58:02 +00:00
<% @series.each do |serie| %>
2015-06-29 17:51:55 +00:00
<tr>
<td><span class="glyphicon glyphicon-list"></span><%= link_to serie.name, serie %></td>
<td>
<%
authors = Array.new
serie.books.each do |book|
authors.concat book.authors
end
unless authors.nil?
#authors.uniq!.sort! { |x,y| x.sort <=> y.sort }
authors.uniq!
authors.sort! { |x,y| x.sort <=> y.sort }
authors.each do |author|
%>
<span class="glyphicon glyphicon-user"></span><%= link_to author.name, author %>
<% end
end %>
</td>
<td><%= serie.books.count %></td>
</tr>
2015-06-29 16:58:02 +00:00
<% end %>
2015-06-29 17:51:55 +00:00
</table>
2015-06-29 16:58:02 +00:00
2015-06-29 17:51:55 +00:00
<%= will_paginate class: "center" %>
<%= render'layouts/perpage' %>