Merge pull request #408 from metaskop/firstlastpage

[req171] added first / last page for paginator
This commit is contained in:
Diego Najar 2017-04-14 10:38:46 +02:00 committed by GitHub
commit d03d8b6ad8
4 changed files with 78 additions and 2 deletions

View File

@ -58,6 +58,40 @@ class Paginator {
return $url.'?page='.self::get('prevPage'); return $url.'?page='.self::get('prevPage');
} }
public static function urlLastPage()
{
global $Url;
$domain = trim(DOMAIN_BASE,'/');
$filter = trim($Url->activeFilter(), '/');
if(empty($filter)) {
$url = $domain.'/'.$Url->slug();
}
else {
$url = $domain.'/'.$filter.'/'.$Url->slug();
}
return $url.'?page='.self::get('numberOfPages');
}
public static function urlFirstPage()
{
global $Url;
$domain = trim(DOMAIN_BASE,'/');
$filter = trim($Url->activeFilter(), '/');
if(empty($filter)) {
$url = $domain.'/'.$Url->slug();
}
else {
$url = $domain.'/'.$filter.'/'.$Url->slug();
}
return $url.'?page=0';
}
public static function html($textPrevPage=false, $textNextPage=false, $showPageNumber=false) public static function html($textPrevPage=false, $textNextPage=false, $showPageNumber=false)
{ {
global $Language; global $Language;

View File

@ -51,6 +51,8 @@
"themes": "Themes", "themes": "Themes",
"prev-page": "Prev page", "prev-page": "Prev page",
"next-page": "Next page", "next-page": "Next page",
"first-page": "First page",
"last-page": "Last page",
"configure-plugin": "Configure plugin", "configure-plugin": "Configure plugin",
"confirm-delete-this-action-cannot-be-undone": "Confirm delete, this action cannot be undone.", "confirm-delete-this-action-cannot-be-undone": "Confirm delete, this action cannot be undone.",
"site-title": "Site title", "site-title": "Site title",

View File

@ -2271,13 +2271,50 @@
content: '\f053'; content: '\f053';
} }
ul.actions.pagination .last {
text-decoration: none;
}
ul.actions.pagination .last:after {
content: "";
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-transform: none !important;
}
ul.actions.pagination .last:after {
content: '\f050';
}
ul.actions.pagination .first {
text-decoration: none;
}
ul.actions.pagination .first:before {
content: "";
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-transform: none !important;
}
ul.actions.pagination .first:before {
content: '\f049';
}
@media screen and (max-width: 1280px) { @media screen and (max-width: 1280px) {
ul.actions.pagination { ul.actions.pagination {
text-align: center; text-align: center;
} }
ul.actions.pagination .next, ul.actions.pagination .previous { ul.actions.pagination .next, ul.actions.pagination .previous,
ul.actions.pagination .last, ul.actions.pagination .first {
min-width: 20em; min-width: 20em;
} }
@ -2285,7 +2322,8 @@
@media screen and (max-width: 736px) { @media screen and (max-width: 736px) {
ul.actions.pagination .next, ul.actions.pagination .previous { ul.actions.pagination .next, ul.actions.pagination .previous,
ul.actions.pagination .last, ul.actions.pagination .first {
min-width: 18em; min-width: 18em;
} }

View File

@ -73,11 +73,13 @@
<ul class="actions pagination"> <ul class="actions pagination">
<?php <?php
if( Paginator::get('showNewer') ) { if( Paginator::get('showNewer') ) {
echo '<li><a href="'.Paginator::urlFirstPage().'" class="button big first">'.$Language->get('First page').'</a></li>';
echo '<li><a href="'.Paginator::urlPrevPage().'" class="button big previous">'.$Language->get('Prev page').'</a></li>'; echo '<li><a href="'.Paginator::urlPrevPage().'" class="button big previous">'.$Language->get('Prev page').'</a></li>';
} }
if( Paginator::get('showOlder') ) { if( Paginator::get('showOlder') ) {
echo '<li><a href="'.Paginator::urlNextPage().'" class="button big next">'.$Language->get('Next page').'</a></li>'; echo '<li><a href="'.Paginator::urlNextPage().'" class="button big next">'.$Language->get('Next page').'</a></li>';
echo '<li><a href="'.Paginator::urlLastPage().'" class="button big last">'.$Language->get('Last page').'</a></li>';
} }
?> ?>
</ul> </ul>