bouquins-ror/app/views/books/_index.html.erb
2015-08-04 18:32:09 +02:00

42 lines
1.1 KiB
Plaintext

<% opts = { data: { url: url_for, remote: true, method: :get } }
content_for :latest_filter do %>
<div class="form-group">
<%= label_tag "sort", "Sort by" %>
<label class="radio-inline">
<%= radio_button_tag "sort", "latest", @preference.sort == "latest",opts %>
Date
</label>
<label class="radio-inline">
<%= radio_button_tag "sort", "alpha", @preference.sort == "alpha", opts %>
Name
</label>
</div>
<% 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" %>