From 0143369e54bb8a0c7b6c9b970ffcde1fd60171ff Mon Sep 17 00:00:00 2001 From: rabuzarus Date: Tue, 14 Mar 2017 18:31:03 +0100 Subject: [PATCH] limit pagination page buttons to max 10 --- include/text.php | 9 +++-- view/theme/frio/css/style.css | 54 ++++++++++++++++++++------ view/theme/frio/templates/paginate.tpl | 16 ++++---- 3 files changed, 57 insertions(+), 22 deletions(-) diff --git a/include/text.php b/include/text.php index 580bd95fc7..6619dec93a 100644 --- a/include/text.php +++ b/include/text.php @@ -291,8 +291,8 @@ function paginate_data(App $a, $count = null) { } $url = $stripped; - $data = array(); + function _l(&$d, $name, $url, $text, $class = '') { if (strpos($url, '?') === false && ($pos = strpos($url, '&')) !== false) { $url = substr($url, 0, $pos) . '?' . substr($url, $pos + 1); @@ -318,9 +318,10 @@ function paginate_data(App $a, $count = null) { $numstart = 1; $numstop = $numpages; - if ($numpages > 14) { - $numstart = (($pagenum > 7) ? ($pagenum - 7) : 1); - $numstop = (($pagenum > ($numpages - 7)) ? $numpages : ($numstart + 14)); + // Limit the number of displayed page number buttons. + if ($numpages > 8) { + $numstart = (($pagenum > 4) ? ($pagenum - 4) : 1); + $numstop = (($pagenum > ($numpages - 7)) ? $numpages : ($numstart + 8)); } $pages = array(); diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 34bcb833db..8d7a5f7696 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -2509,21 +2509,53 @@ body .tread-wrapper .hovercard:hover .hover-card-content a { } /* Pagination improvements */ +.pagination { + text-align: center; + display: block; +} .pagination > li > a, .pagination > li > span { - color: $link_color; -} -.pagination>.active>a, -.pagination>.active>a:focus, -.pagination>.active>a:hover, -.pagination>.active>span, -.pagination>.active>span:focus, -.pagination>.active>span:hover { - background-color: $link_color; + color: $link_color; + float: none; +} +.pagination>li>a:hover, +.pagination>li>span:hover { + color: $link_hover_color; +} +.pagination > .active > a, +.pagination > .active > a:focus, +.pagination > .active > a:hover, +.pagination > .active > span, +.pagination > .active > span:focus, +.pagination > .active > span:hover { + background-color: $link_color; border-color: $link_color; + border-radius: 3px; } -.disabled > a { - pointer-events: none; +.pagination li.pager_n a { + margin-left: 3px; + border-radius: 3px; +} +.pagination .pager_prev a { + margin-left: -5px; + margin-right: 4px; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +.pagination .pager_next a { + margin-left: 4px; + margin-right: -5px; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} +.pager .next > a, +.pager .previous > a { + float: none; + border-radius: 3px; +} +.pagination .disabled > a, +.pager .disabled > a { + display: none; } /* diff --git a/view/theme/frio/templates/paginate.tpl b/view/theme/frio/templates/paginate.tpl index ab65cdd406..252dd7e5b0 100644 --- a/view/theme/frio/templates/paginate.tpl +++ b/view/theme/frio/templates/paginate.tpl @@ -1,14 +1,16 @@ + {{* Pager template, uses output of paginate_data() in include/text.php *}} + {{if $pager}} -
- {{if $pager.first}}
  • {{$pager.first.text}}
  • {{/if}} +
    + {{if $pager.last}}
  • >∣
  • {{/if}} + {{/if}} -- 2.39.5