bouquins-ror/app/views/books/_index.html.erb
2015-08-03 11:54:44 +02:00

32 lines
947 B
Plaintext

<% content_for :latest_filter do
isLatest = session[:sort] == "latest" %>
<%= link_to "Latest", url_for(sort: (isLatest ? "alpha" : "latest")), class: "btn btn-default btn-sm " + (isLatest ? " active" : ""), remote: true %>
<% end %>
<%= render'layouts/filter' %>
<%= will_paginate class: "center" %>
<table class="table table-striped authors">
<tr>
<th>Name</th>
<th>Authors</th>
<th>Serie</th>
</tr>
<% @books.each do |book| %>
<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 %>
</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" %>