42 lines
1.0 KiB
Plaintext
42 lines
1.0 KiB
Plaintext
% layout 'default';
|
|
% title 'Books';
|
|
<h1><%= title %></h1>
|
|
|
|
<%# On a new search, reset the page number to 1. %>
|
|
%= form_for books => { page_number => 1 } => begin
|
|
<span>
|
|
%= label_for title_like => 'Title like'
|
|
%= text_field title_like => flash('title_like')
|
|
</span>
|
|
<span>
|
|
%= label_for author_like => 'Author like'
|
|
%= text_field author_like => flash('author_like')
|
|
</span>
|
|
%= submit_button "Search"
|
|
%= end
|
|
|
|
% if ($pager->total_entries > 0) {
|
|
<p/>
|
|
<div>
|
|
<table>
|
|
<tr class="header">
|
|
<th class="book-medium">Title</th><th class="author-medium">Author</th>
|
|
</tr>
|
|
% my $n = 0; for my $book ($book_page->all) {
|
|
<tr <%== 'class="odd"' if (++$n % 2) %>>
|
|
<td><%= link_to(
|
|
trct($book->title, 55) => gutenberg_url($book->gutenberg_id)
|
|
) %>
|
|
</td>
|
|
<td>
|
|
<%= link_to(trct($book->author->name, 45) => 'author' =>
|
|
{ id => $book->author->id, page_number => 1 }) %>
|
|
</td>
|
|
</tr>
|
|
% }
|
|
</table>
|
|
</div>
|
|
% }
|
|
|
|
%= include '_page-navigation', items_name => 'books';
|