This commit is contained in:
Meutel 2015-06-29 19:51:55 +02:00
parent d629153e0f
commit a7f091ab83
5 changed files with 70 additions and 22 deletions

View File

@ -1,9 +1,16 @@
<%= will_paginate %>
<%= will_paginate class: "center" %>
<ul class="authors">
<table class="table table-striped authors">
<tr>
<th>Name</th>
<th>Books</th>
</tr>
<% @authors.each do |author| %>
<li><%= link_to author.name, author %></li>
<tr>
<td><span class="glyphicon glyphicon-user"></span><%= link_to author.name, author %></td>
<td><%= author.books.count %></td>
</tr>
<% end %>
</ul>
</table>
<%= will_paginate %>
<%= will_paginate class: "center" %>

View File

@ -1,12 +1,27 @@
<%= will_paginate %>
<%= will_paginate class: "center" %>
<ul class="books">
<table class="table table-striped authors">
<tr>
<th>Name</th>
<th>Authors</th>
<th>Serie</th>
</tr>
<% @books.each do |book| %>
<li>
<%= link_to book.title, book %>
</li>
<tr>
<td><span class="glyphicon glyphicon-book"></span><%= link_to book.title, book %></td>
<td>
<% book.authors.each do |author| %>
<span class="glyphicon glyphicon-user"></span><%= link_to author.name, author %>
<% end %>
</ul>
<%= will_paginate %>
</td>
<td>
<% if book.serie %>
<span class="glyphicon glyphicon-list"></span><%= link_to book.serie.name, book.serie %>
<span class="badge"><%= book.series_index.to_i %></span>
<% end %>
</td>
</tr>
<% end %>
</table>
<%= will_paginate class: "center" %>

View File

@ -1,9 +1,33 @@
<%= will_paginate %>
<%= will_paginate class: "center" %>
<ul class="series">
<table class="table table-striped series">
<tr>
<th>Name</th>
<th>Authors</th>
<th>Books</th>
</tr>
<% @series.each do |serie| %>
<li><%= link_to serie.name, serie %></li>
<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>
<% end %>
</ul>
</table>
<%= will_paginate %>
<%= will_paginate class: "center" %>

View File

@ -18,8 +18,10 @@ authors = Array.new
@serie.books.each do |book|
authors.concat book.authors
end
authors.uniq!.sort! { |x,y| x.sort <=> y.sort }
if authors %>
if authors
authors.uniq!
authors.sort! { |x,y| x.sort <=> y.sort }
%>
<h2>
<span class="glyphicon glyphicon-user"></span>
<%= "Author".pluralize(authors.count) %>

View File

@ -8,5 +8,5 @@
<%= link_to "Series", series_path, class: "btn btn-lg btn-primary", remote: true %>
</p>
</div>
<div class="center container-fluid" id="items">
<div class="container-fluid" id="items">
</div>