Skip to content

Commit

Permalink
Simplify pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
willfaught committed Jun 7, 2024
1 parent cdddf78 commit 688dfbb
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 366 deletions.
15 changes: 15 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,34 @@ paige_edit_history:
paige_edit_this_page:
other: Edit this page

paige_first:
other: First

paige_last:
other: Last

paige_minutes:
one: minute
other: minutes

paige_next:
other: Next

paige_noscript:
other: JavaScript is required.

paige_page_list_navigation:
other: Page list navigation

paige_pages:
other: Pages

paige_pinned_page:
other: Pinned page

paige_previous:
other: Previous

paige_recent_content:
other: Recent content

Expand Down
30 changes: 29 additions & 1 deletion layouts/partials/paige/pages.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,35 @@ <h3 class="h5 paige-date-header text-center">{{ .Key }}</h3>
{{ if or $pager.HasPrev $pager.HasNext }}
<div id="paige-pagination">
<div class="d-flex justify-content-center">
{{ partial "paige/pagination.html" $page }}
<nav aria-label="{{ i18n `paige_page_list_navigation` }}">
<ul class="pagination">
{{ with $page.Paginator }}
{{ if and (ne .PageNumber .First.PageNumber) (ne .First.PageNumber .Prev.PageNumber) }}
<li class="page-item">
<a aria-label="{{ i18n `paige_first` }}" class="page-link" href="{{ .First.URL }}"><span aria-hidden="true">&laquo;</span></a>
</li>
{{ end }}

{{ with .Prev }}
<li class="page-item">
<a aria-label="{{ i18n `paige_previous` }}" class="page-link" href="{{ .URL }}"><span aria-hidden="true">&lsaquo;</span></a>
</li>
{{ end }}

{{ with .Next }}
<li class="page-item">
<a aria-label="{{ i18n `paige_next` }}" class="page-link" href="{{ .URL }}"><span aria-hidden="true">&rsaquo;</span></a>
</li>
{{ end }}

{{ if and (ne .PageNumber .Last.PageNumber) (ne .Last.PageNumber .Next.PageNumber) }}
<li class="page-item">
<a aria-label="{{ i18n `paige_last` }}" class="page-link" href="{{ .Last.URL }}"><span aria-hidden="true">&raquo;</span></a>
</li>
{{ end }}
{{ end }}
</ul>
</nav>
</div>
</div>
{{ end }}
Expand Down
Loading

0 comments on commit 688dfbb

Please sign in to comment.