Make pagination padding clickable again #40
@ -74,6 +74,10 @@ a:hover {
|
|||||||
|
|
||||||
.pagination .page-item {
|
.pagination .page-item {
|
||||||
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
|
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.pagination .wildcard {
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
@ -88,13 +92,16 @@ a:hover {
|
|||||||
.pagination .page-link {
|
.pagination .page-link {
|
||||||
border-radius: var(--bs-pagination-border-radius) !important;
|
border-radius: var(--bs-pagination-border-radius) !important;
|
||||||
}
|
}
|
||||||
.pagination > :first-child, .pagination > :last-child {
|
.pagination > :first-child, .pagination > :last-child, .pagination .first-wildcard {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
.pagination > :first-child {
|
.pagination > :first-child {
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
.pagination > .first-wildcard {
|
||||||
|
left: 48%;
|
||||||
|
}
|
||||||
.pagination > :last-child {
|
.pagination > :last-child {
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ class PageIndexWidget extends Template
|
|||||||
private $index;
|
private $index;
|
||||||
private string $class;
|
private string $class;
|
||||||
|
|
||||||
|
private static $unique_index_count = 0;
|
||||||
|
|
||||||
public function __construct(PageIndex $index)
|
public function __construct(PageIndex $index)
|
||||||
{
|
{
|
||||||
$this->index = $index;
|
$this->index = $index;
|
||||||
@ -37,14 +39,22 @@ class PageIndexWidget extends Template
|
|||||||
'<a class="page-link"', !empty($page_index['previous']) ? ' href="' . $page_index['previous']['href'] . '"' : '', '>',
|
'<a class="page-link"', !empty($page_index['previous']) ? ' href="' . $page_index['previous']['href'] . '"' : '', '>',
|
||||||
'« previous</a></li>';
|
'« previous</a></li>';
|
||||||
|
|
||||||
|
$num_wildcards = 0;
|
||||||
foreach ($page_index as $key => $page)
|
foreach ($page_index as $key => $page)
|
||||||
{
|
{
|
||||||
if (!is_numeric($key))
|
if (!is_numeric($key))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!is_array($page))
|
if (!is_array($page))
|
||||||
|
{
|
||||||
|
$first_wildcard = $num_wildcards === 0;
|
||||||
|
$num_wildcards++;
|
||||||
echo '
|
echo '
|
||||||
<li class="page-item page-padding disabled"><a class="page-link">...</a></li>';
|
<li class="page-item page-padding wildcard',
|
||||||
|
$first_wildcard ? ' first-wildcard' : '',
|
||||||
|
'" onclick="javascript:promptGoToPage(',
|
||||||
|
self::$unique_index_count, ')"><a class="page-link">...</a></li>';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
echo '
|
echo '
|
||||||
<li class="page-item page-number', $page['is_selected'] ? ' active" aria-current="page' : '', '">',
|
<li class="page-item page-number', $page['is_selected'] ? ' active" aria-current="page' : '', '">',
|
||||||
@ -56,5 +66,17 @@ class PageIndexWidget extends Template
|
|||||||
'<a class="page-link"', !empty($page_index['next']) ? ' href="' . $page_index['next']['href'] . '"' : '', '>',
|
'<a class="page-link"', !empty($page_index['next']) ? ' href="' . $page_index['next']['href'] . '"' : '', '>',
|
||||||
'next »</a></li>
|
'next »</a></li>
|
||||||
</ul>';
|
</ul>';
|
||||||
|
|
||||||
|
if ($num_wildcards)
|
||||||
|
{
|
||||||
|
echo '
|
||||||
|
<script type="text/javascript">
|
||||||
|
var page_index_', self::$unique_index_count++, ' = {
|
||||||
|
wildcard_url: "', $index->getLink("%d"), '",
|
||||||
|
num_pages: ', $index->getNumberOfPages(), ',
|
||||||
|
per_page: ', $index->getItemsPerPage(), '
|
||||||
|
};
|
||||||
|
</script>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user