Various template improvements.

This commit is contained in:
barnold 2022-09-18 18:08:40 +01:00
parent 3dc4410342
commit c9c248a4b3
3 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,7 @@
% layout 'default';
% title 'Author: ' . $author->name;
<h1>Author: <%= $author->name %></h1>
<h1><%= title %></h1>
<strong><%= $author->name %></strong> wrote <%= $author->books->count %> books.
<strong><%= $author->name %></strong>
% my $count = $author->books->count;
wrote <%= $count %> book<%= "s" if ($count > 1) %>.

View File

@ -1,6 +1,6 @@
% layout 'default';
% title 'Authors';
<h1>Author page</h1>
<h1>Authors</h1>
<%# On a new search, reset the page number to 1. %>
%= form_for authors => { page_number => 1 } => begin
@ -16,11 +16,13 @@
<div>
<table>
<tr>
<th>Name</th>
<th>Books</th>
<th>Authored by</th>
</tr>
% for my $author ($author_page->all) {
<tr>
<td><%= link_to($author->name => 'author' => { id => $author->id}) %></td>
<td style="text-align:right"><%= $author->books->count %></td>
<td style="padding-left:1em"><%= link_to($author->name => 'author' => { id => $author->id}) %></td>
</tr>
% }
</table>

View File

@ -1,6 +1,6 @@
% layout 'default';
% title 'Books';
<h1>Book page</h1>
<h1>Books</h1>
<%# On a new search, reset the page number to 1. %>
%= form_for books => { page_number => 1 } => begin
@ -21,7 +21,9 @@
% for my $book ($book_page->all) {
<tr>
<td><%= $book->title %></td>
<td><%= $book->author->name %></td>
<td>
<%= link_to($book->author->name => 'author' => { id => $book->author->id}) %>
</td>
</tr>
% }
</table>