Skip to content

Commit

Permalink
MAN-354 pagination links bugfix (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-mills authored Jan 30, 2025
1 parent 1478c21 commit 4014551
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions server/views/_components/pagination/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
{% set currentPage = params.currentPage or 0 %}
{% set totalPages = params.totalPages %}
{% set url = params.url or '' %}
{% set totalLinks = 3 %}
{% if totalLinks > totalPages %}
{% set totalLinks = totalPages %}
{% endif %}
{% set start = 0 %}
{% set end = start + 3 %}
{% set end = start + totalLinks %}
{% if currentPage > 0 %}
{% set start = currentPage -1 %}
{% set end = start + 3 %}
{% set end = start + totalLinks %}
{% endif %}
{% if currentPage + 1 == totalPages %}
{% set start = currentPage - 2 %}
{% set start = currentPage - (totalLinks -1) %}
{% set end = totalPages %}
{% endif %}

Expand Down

0 comments on commit 4014551

Please sign in to comment.