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 This is a Mojolicious web site app for looking through the catalog
provided by Project Gutenberg <https://www.gutenberg.org/>. It uses 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 COPYING

View File

@ -3,6 +3,11 @@ use Mojo::Base 'Mojolicious::Controller', -signatures;
use MyModel::Book; use MyModel::Book;
use MyModel::Author; 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) { sub books ($self) {
my $page_number = $self->accept_posint($self->param('page_number')); my $page_number = $self->accept_posint($self->param('page_number'));
if (!defined $page_number) { if (!defined $page_number) {

View File

@ -8,7 +8,8 @@
Thanks to <a href="https://www.gutenberg.org/">Project Thanks to <a href="https://www.gutenberg.org/">Project
Gutenberg</a>, this is a site for looking through the book catalog Gutenberg</a>, this is a site for looking through the book catalog
they generously provide. It's a personal project and is not 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. book records out of 68,670 in the catalog.
</p> </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 really the relationship between "book" and "author" is many-to-many
between "book" and "contributor". For simplicity, this site ignores between "book" and "contributor". For simplicity, this site ignores
the distinction and pretends that a book has exactly one author. Books the distinction and pretends that a book has exactly one author. Books
with "excessive" numbers of contributors (more than 64 bytes' worth) with "excessive" numbers of contributors (more than 128 characters'
are excluded from this site. A future version might aim to represent worth) are excluded from this site. A future version might aim to
the book-contributor relationship more faithfully. represent the book-contributor relationship more faithfully.
</p> </p>
<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. links to its page on PG's site.
</p> </p>
<h2>Logs, cookies and tracking</h2>
<p> <p>
We keep the usual kind of web site logs that include your ip 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 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 cookie so that you can change the number of records per page. We
don't use javascript, analytics, tracking, CDNs or other third-party don't use javascript, tracking, CDNs or any third-party web
web services. services.
</p> </p>
<h2 id="search-help">Searching</h2> <h2 id="search-help">Searching</h2>
@ -65,7 +68,14 @@ or "Name like" on the authors page). Other non-authors are
"Anonymous" and "Unknown". "Anonymous" and "Unknown".
</p> </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'}) { % if (config->{'email-address'}) {
<h2>Contact</h2>
<p> <p>
Comments and questions are welcome at Comments and questions are welcome at
<a href="mailto:<%= config->{'email-address'} %>"><%= config->{'email-name'} %></a>. <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) %>> <tr <%== 'class="odd"' if (++$n % 2) %>>
<td class="count"><%= $author->books->count %></td> <td class="count"><%= $author->books->count %></td>
<td> <td>
<%= link_to($author->name => 'author' => <%= link_to(trct($author->name, 100) => 'author' =>
{ id => $author->id, page_number => 1 }) %> { id => $author->id, page_number => 1 }) %>
</td> </td>
</tr> </tr>

View File

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