Some tweaks to collections

This commit is contained in:
Alex Cabal 2023-02-16 18:37:20 -06:00
parent e2dd256edc
commit 1e32a97c7d
5 changed files with 11 additions and 22 deletions

View file

@ -251,7 +251,6 @@ Define webroot /standardebooks.org/web
RewriteRule ^/ebooks/([^\./]+?)/downloads$ /bulk-downloads/get.php?author=$1 [QSA] RewriteRule ^/ebooks/([^\./]+?)/downloads$ /bulk-downloads/get.php?author=$1 [QSA]
RewriteRule ^/ebooks/([^\./]+?)/feeds$ /feeds/get.php?author=$1 [QSA] RewriteRule ^/ebooks/([^\./]+?)/feeds$ /feeds/get.php?author=$1 [QSA]
RewriteRule ^/subjects/([^\./]+?)$ /ebooks/index.php?tags[]=$1 [QSA] RewriteRule ^/subjects/([^\./]+?)$ /ebooks/index.php?tags[]=$1 [QSA]
RewriteRule ^/collections$ /collections/index.php [L]
RewriteRule ^/collections/([^\./]+?)$ /ebooks/index.php?collection=$1 [QSA] RewriteRule ^/collections/([^\./]+?)$ /ebooks/index.php?collection=$1 [QSA]
RewriteRule ^/collections/([^/]+?)/downloads$ /bulk-downloads/get.php?collection=$1 RewriteRule ^/collections/([^/]+?)/downloads$ /bulk-downloads/get.php?collection=$1
RewriteRule ^/collections/([^/]+?)/feeds$ /feeds/get.php?collection=$1 RewriteRule ^/collections/([^/]+?)/feeds$ /feeds/get.php?collection=$1

View file

@ -233,7 +233,6 @@ Define webroot /standardebooks.org/web
RewriteRule ^/ebooks/([^\./]+?)/downloads$ /bulk-downloads/get.php?author=$1 [QSA] RewriteRule ^/ebooks/([^\./]+?)/downloads$ /bulk-downloads/get.php?author=$1 [QSA]
RewriteRule ^/ebooks/([^\./]+?)/feeds$ /feeds/get.php?author=$1 [QSA] RewriteRule ^/ebooks/([^\./]+?)/feeds$ /feeds/get.php?author=$1 [QSA]
RewriteRule ^/subjects/([^\./]+?)$ /ebooks/index.php?tags[]=$1 [QSA] RewriteRule ^/subjects/([^\./]+?)$ /ebooks/index.php?tags[]=$1 [QSA]
RewriteRule ^/collections$ /collections/index.php [L]
RewriteRule ^/collections/([^\./]+?)$ /ebooks/index.php?collection=$1 [QSA] RewriteRule ^/collections/([^\./]+?)$ /ebooks/index.php?collection=$1 [QSA]
RewriteRule ^/collections/([^/]+?)/downloads$ /bulk-downloads/get.php?collection=$1 RewriteRule ^/collections/([^/]+?)/downloads$ /bulk-downloads/get.php?collection=$1
RewriteRule ^/collections/([^/]+?)/feeds$ /feeds/get.php?collection=$1 RewriteRule ^/collections/([^/]+?)/feeds$ /feeds/get.php?collection=$1

View file

@ -451,6 +451,7 @@ class Library{
if($collator === null){ if($collator === null){
throw new Exceptions\SeException('Couldn\'t create collator object when rebuilding cache.'); throw new Exceptions\SeException('Couldn\'t create collator object when rebuilding cache.');
} }
$ebooks = []; $ebooks = [];
$ebooksByCollection = []; $ebooksByCollection = [];
$ebooksByTag = []; $ebooksByTag = [];

View file

@ -1,14 +0,0 @@
<table class="download-list">
<thead>
<tr class="mid-header">
<th scope="col">Collection</th>
</tr>
</thead>
<tbody>
<? foreach($collections as $collection){ ?>
<tr>
<td class="row-header"><a href="<?= $collection->Url ?>"><?= Formatter::ToPlainText($collection->Name) ?></a></td>
</tr>
<? } ?>
</tbody>
</table>

View file

@ -1,20 +1,24 @@
<? <?
require_once('Core.php'); require_once('Core.php');
use function Safe\apcu_fetch; $collections = Library::GetEbookCollections();
$collection = Library::GetEbookCollections();
?><?= Template::Header(['title' => 'Ebook Collections', 'highlight' => '', 'description' => 'Browse collections of Standard Ebooks.']) ?> ?><?= Template::Header(['title' => 'Ebook Collections', 'highlight' => '', 'description' => 'Browse collections of Standard Ebooks.']) ?>
<main> <main>
<section class="narrow has-hero"> <section class="narrow has-hero">
<h1>Ebook Collections</h1> <h1>Ebook Collections</h1>
<picture data-caption="Still Life with Books. Jan Davidsz. de Heem, 1625"> <picture data-caption="Still Life with Books and a Violin. Jan Davidszoon de Heem, 1625">
<source srcset="/images/still-life-with-books@2x.avif 2x, /images/still-life-with-books.avif 1x" type="image/avif"/> <source srcset="/images/still-life-with-books@2x.avif 2x, /images/still-life-with-books.avif 1x" type="image/avif"/>
<source srcset="/images/still-life-with-books@2x.jpg 2x, /images/still-life-with-books.jpg 1x" type="image/jpg"/> <source srcset="/images/still-life-with-books@2x.jpg 2x, /images/still-life-with-books.jpg 1x" type="image/jpg"/>
<img src="/images/still-life-with-books@2x.jpg" alt="A gentleman in regency-era dress buys books from a bookseller."/> <img src="/images/still-life-with-books@2x.jpg" alt="A pile of moldering books lying on a table."/>
</picture> </picture>
<?= Template::CollectionTable(['collections' => $collection]); ?> <ul>
<? foreach($collections as $collection){ ?>
<li>
<p><a href="<?= $collection->Url ?>"><?= Formatter::ToPlainText($collection->Name) ?></a></p>
</li>
<? } ?>
</ul>
</section> </section>
</main> </main>
<?= Template::Footer() ?> <?= Template::Footer() ?>