Compare commits

...

3 Commits

Author SHA1 Message Date
barnold 12b8f797c5 Another update for about. 2022-10-13 09:09:41 +01:00
barnold 92ddca2c0d Tweak how much of names and titles to display in tables. 2022-10-12 19:37:20 +01:00
barnold 179be1f700 De-hardcode the book count. 2022-10-12 19:09:06 +01:00
5 changed files with 26 additions and 10 deletions

3
README
View File

@ -2,7 +2,8 @@ ABOUT
This is a Mojolicious web site app for looking through the catalog
provided by Project Gutenberg <https://www.gutenberg.org/>. It uses
the database provided by <https://tildegit.org/barnold/pgc-db>.
the database and perl modules provided by
<https://tildegit.org/barnold/pgc-db>.
COPYING

View File

@ -3,6 +3,11 @@ use Mojo::Base 'Mojolicious::Controller', -signatures;
use MyModel::Book;
use MyModel::Author;
sub about ($self) {
my $book_count = MyModel::Book->new(rows_per_page => $self->rpp)->count_all;
$self->render(book_count => $book_count);
}
sub books ($self) {
my $page_number = $self->accept_posint($self->param('page_number'));
if (!defined $page_number) {

View File

@ -8,7 +8,8 @@
Thanks to <a href="https://www.gutenberg.org/">Project
Gutenberg</a>, this is a site for looking through the book catalog
they generously provide. It's a personal project and is not
affiliated with Project Gutenberg. The site currently offers 51,922
affiliated with Project Gutenberg. The site currently offers
<%= commify($book_count) %>
book records out of 68,670 in the catalog.
</p>
@ -21,9 +22,9 @@ more <em>contributors</em> - authors, editors, illustrators etc. So
really the relationship between "book" and "author" is many-to-many
between "book" and "contributor". For simplicity, this site ignores
the distinction and pretends that a book has exactly one author. Books
with "excessive" numbers of contributors (more than 64 bytes' worth)
are excluded from this site. A future version might aim to represent
the book-contributor relationship more faithfully.
with "excessive" numbers of contributors (more than 128 characters'
worth) are excluded from this site. A future version might aim to
represent the book-contributor relationship more faithfully.
</p>
<p>
@ -34,12 +35,14 @@ distinct editions or versions. Each book title shown on this site
links to its page on PG's site.
</p>
<h2>Logs, cookies and tracking</h2>
<p>
We keep the usual kind of web site logs that include your ip
address, user agent and the page you requested. We use a session
cookie so that you can change the number of records per page. We
don't use javascript, analytics, tracking, CDNs or other third-party
web services.
don't use javascript, tracking, CDNs or any third-party web
services.
</p>
<h2 id="search-help">Searching</h2>
@ -65,7 +68,14 @@ or "Name like" on the authors page). Other non-authors are
"Anonymous" and "Unknown".
</p>
<h2>Software</h2>
This site is an instance of
<a href="https://tildegit.org/barnold/pgc-www">pgc-www</a>.
% if (config->{'email-address'}) {
<h2>Contact</h2>
<p>
Comments and questions are welcome at
<a href="mailto:<%= config->{'email-address'} %>"><%= config->{'email-name'} %></a>.

View File

@ -28,7 +28,7 @@ min => 0, maxlength => 4, size => 4 %> books
<tr <%== 'class="odd"' if (++$n % 2) %>>
<td class="count"><%= $author->books->count %></td>
<td>
<%= link_to($author->name => 'author' =>
<%= link_to(trct($author->name, 100) => 'author' =>
{ id => $author->id, page_number => 1 }) %>
</td>
</tr>

View File

@ -25,11 +25,11 @@
% my $n = 0; for my $book ($book_page->all) {
<tr <%== 'class="odd"' if (++$n % 2) %>>
<td><%= link_to(
trct($book->title, 50) => gutenberg_url($book->gutenberg_id)
trct($book->title, 55) => gutenberg_url($book->gutenberg_id)
) %>
</td>
<td>
<%= link_to(trct($book->author->name, 40) => 'author' =>
<%= link_to(trct($book->author->name, 45) => 'author' =>
{ id => $book->author->id, page_number => 1 }) %>
</td>
</tr>