mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
Pagination: Make it a LOT better
thx grinotion for the idea xddddd
This commit is contained in:
parent
478f8f9368
commit
7d94282ad4
2 changed files with 35 additions and 12 deletions
|
@ -1,14 +1,16 @@
|
|||
{var $space = 2}
|
||||
{var $pageCount = ceil($conf->count / $conf->perPage)}
|
||||
|
||||
<div n:if="!($conf->page === 1 && $conf->count <= $conf->perPage)" class="paginator">
|
||||
<br/>
|
||||
<center>
|
||||
<a n:if="$conf->page != 1"
|
||||
href="?{http_build_query(array_merge($_GET, ['p' => ($conf->page - 1)]), 'k', '&', PHP_QUERY_RFC3986)}"
|
||||
style="float: left;"><< {_paginator_back}</a>
|
||||
|
||||
{tr("paginator_page", $conf->page)}
|
||||
|
||||
<a n:if="$conf->count > (($conf->page - 1) * $conf->perPage + $conf->amount) && $conf->amount > 0"
|
||||
href="?{http_build_query(array_merge($_GET, ['p' => ($conf->page + 1)]), 'k', '&', PHP_QUERY_RFC3986)}"
|
||||
style="float: right;">{_paginator_next} >></a>
|
||||
</center>
|
||||
{if $conf->page > $space}
|
||||
<a n:attr="class => ($conf->page === 1 ? 'active')" href="?{http_build_query(array_merge($_GET, ['p' => 1]), 'k', '&', PHP_QUERY_RFC3986)}">«</a>
|
||||
{/if}
|
||||
{for $j = $conf->page - ($space-1); $j <= $conf->page + ($space-1); $j++}
|
||||
{if $j > 0 && $j <= $pageCount}
|
||||
<a n:attr="class => ($conf->page === $j ? 'active')" href="?{http_build_query(array_merge($_GET, ['p' => $j]), 'k', '&', PHP_QUERY_RFC3986)}">{$j}</a>
|
||||
{/if}
|
||||
{/for}
|
||||
{if $conf->page <= $pageCount-$space}
|
||||
<a n:attr="class => ($conf->page === $pageCount ? 'active')" href="?{http_build_query(array_merge($_GET, ['p' => $pageCount]), 'k', '&', PHP_QUERY_RFC3986)}">»</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
@ -1525,3 +1525,24 @@ body.scrolled .toTop:hover {
|
|||
color: rgb(128, 128, 128);
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.paginator {
|
||||
float: right;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.paginator a {
|
||||
border-top: 3px solid transparent;
|
||||
display: inline-block;
|
||||
padding: 4px 5px;
|
||||
}
|
||||
|
||||
.paginator a:hover {
|
||||
border-top: 3px solid rgb(170, 170, 170);
|
||||
background-color: rgb(230, 230, 230);
|
||||
}
|
||||
|
||||
.paginator a.active {
|
||||
border-top: 3px solid rgb(130, 130, 130);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue