Make tables stripy.

This commit is contained in:
barnold 2022-09-27 10:56:45 +01:00
parent 36637c9f79
commit 8486f59985
4 changed files with 18 additions and 9 deletions

View File

@ -1,5 +1,6 @@
table {
border: 1px solid grey;
background: #f0fff0;
}
th {
@ -29,3 +30,11 @@ th.book-medium {
th.book-wide {
min-width: 35em;
}
tr.header {
background: #f5f5f5;
}
tr.odd {
background: #ffffe0;
}

View File

@ -7,11 +7,11 @@ Books by <strong><%= $author->name %></strong>
<p/>
<div>
<table>
<tr>
<tr class="header">
<th class="book-wide">Title</th>
</tr>
% for my $book ($book_page->all) {
<tr>
% my $n = 0; for my $book ($book_page->all) {
<tr <%== 'class="odd"' if (++$n % 2) %>>
<td><%= link_to(
trct($book->title, 100) => gutenberg_url($book->gutenberg_id)
) %>

View File

@ -16,12 +16,12 @@
<p/>
<div>
<table>
<tr>
<tr class="header">
<th class="count">Books</th>
<th class="author-wide">Authored by</th>
</tr>
% for my $author ($author_page->all) {
<tr>
% my $n = 0; for my $author ($author_page->all) {
<tr <%== 'class="odd"' if (++$n % 2) %>>
<td class="count"><%= $author->books->count %></td>
<td>
<%= link_to($author->name => 'author' =>

View File

@ -19,11 +19,11 @@ author like '[no author]'.
<p/>
<div>
<table>
<tr>
<tr class="header">
<th class="book-medium">Title</th><th class="author-medium">Author</th>
</tr>
% for my $book ($book_page->all) {
<tr>
% 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)
) %>