bouquins-ror/app/views/books/_index.html.erb
2015-08-02 11:12:04 +02:00

39 lines
1.1 KiB
Plaintext

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Filter</h3>
</div>
<div class="panel-body">
<% isLatest = session[:sort] == "latest" %>
<%= link_to "Latest", url_for(sort: (isLatest ? "alpha" : "latest")), class: "btn btn-default btn-sm " + (isLatest ? " active" : ""), remote: true %>
<%= render'layouts/initials' %>
</div>
</div>
<%= 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" %>
<%= render'layouts/perpage' %>