feat(tags): this adds support for post, link, book, show and movie tags with a tag list view and per tag pages
This commit is contained in:
parent
3d866262ca
commit
6fdc0b56b9
35 changed files with 500 additions and 70 deletions
44
server/utils/paginator.php
Normal file
44
server/utils/paginator.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/icons.php';
|
||||
|
||||
function renderPaginator(array $pagination, int $totalPages): void {
|
||||
if (!$pagination || $totalPages <= 1) return;
|
||||
?>
|
||||
|
||||
<script type="module" src="/assets/scripts/components/select-pagination.js" defer></script>
|
||||
<nav aria-label="Pagination" class="pagination">
|
||||
<?php if (!empty($pagination['href']['previous'])): ?>
|
||||
<a href="<?= $pagination['href']['previous'] ?>" aria-label="Previous page">
|
||||
<?= getTablerIcon('arrow-left') ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<span><?= getTablerIcon('arrow-left') ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<select-pagination data-base-index="1">
|
||||
<select class="client-side" aria-label="Page selection">
|
||||
<?php foreach ($pagination['pages'] as $i): ?>
|
||||
<option value="<?= $i ?>" <?= ($pagination['pageNumber'] === $i) ? 'selected' : '' ?>>
|
||||
<?= $i ?> of <?= $totalPages ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<noscript>
|
||||
<p>
|
||||
<span aria-current="page"><?= $pagination['pageNumber'] ?></span> of <?= $totalPages ?>
|
||||
</p>
|
||||
</noscript>
|
||||
</select-pagination>
|
||||
|
||||
<?php if (!empty($pagination['href']['next'])): ?>
|
||||
<a href="<?= $pagination['href']['next'] ?>" aria-label="Next page">
|
||||
<?= getTablerIcon('arrow-right') ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<span><?= getTablerIcon('arrow-right') ?></span>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
|
||||
<?php
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue