From 7d94282ad45484c2e988f7c7523dbb887c2dce6e Mon Sep 17 00:00:00 2001 From: veselcraft Date: Sat, 27 Nov 2021 15:19:17 +0300 Subject: [PATCH] Pagination: Make it a LOT better thx grinotion for the idea xddddd --- .../templates/components/paginator.xml | 26 ++++++++++--------- Web/static/css/style.css | 21 +++++++++++++++ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/Web/Presenters/templates/components/paginator.xml b/Web/Presenters/templates/components/paginator.xml index 4cf45257..8d1fec43 100644 --- a/Web/Presenters/templates/components/paginator.xml +++ b/Web/Presenters/templates/components/paginator.xml @@ -1,14 +1,16 @@ +{var $space = 2} +{var $pageCount = ceil($conf->count / $conf->perPage)} +
-
-
- << {_paginator_back} - - {tr("paginator_page", $conf->page)} - - {_paginator_next} >> -
+ {if $conf->page > $space} + « + {/if} + {for $j = $conf->page - ($space-1); $j <= $conf->page + ($space-1); $j++} + {if $j > 0 && $j <= $pageCount} + {$j} + {/if} + {/for} + {if $conf->page <= $pageCount-$space} + » + {/if}
diff --git a/Web/static/css/style.css b/Web/static/css/style.css index 443b8cc4..b5b36472 100644 --- a/Web/static/css/style.css +++ b/Web/static/css/style.css @@ -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; +}