Link book title to its gutenberg page.

This commit is contained in:
barnold 2022-09-26 09:14:39 +01:00
parent 646d0c4084
commit 9f16a10009
3 changed files with 13 additions and 2 deletions

View File

@ -39,6 +39,11 @@ sub add_my_helpers ($self) {
return $self->config->{'default-rows-per-page'};
}
);
$self->helper(
gutenberg_url => sub ($self, $gid) {
return "https://gutenberg.org/ebooks/" . $gid;
}
);
$self->helper(
logname => sub ($self) { $self->session('logname'); }
);

View File

@ -12,7 +12,10 @@ Books by <strong><%= $author->name %></strong>
</tr>
% for my $book ($book_page->all) {
<tr>
<td><%= trct($book->title, 100) %></td>
<td><%= link_to(
trct($book->title, 100) => gutenberg_url($book->gutenberg_id)
) %>
</td>
</tr>
% }
</table>

View File

@ -20,7 +20,10 @@
</tr>
% for my $book ($book_page->all) {
<tr>
<td><%= trct($book->title, 50) %></td>
<td><%= link_to(
trct($book->title, 50) => gutenberg_url($book->gutenberg_id)
) %>
</td>
<td>
<%= link_to(trct($book->author->name, 40) => 'author' =>
{ id => $book->author->id, page_number => 1 }) %>