2023-06-22 03:46:27 +00:00
|
|
|
<!--
|
|
|
|
A simple and generic Paginator row, with page buttons and Previous/Next
|
|
|
|
|
|
|
|
Usage: [[SimplePager .Pager]]
|
|
|
|
|
|
|
|
Give it your Pagination object (with .Previous, .Next, .Iter() and so on). It
|
|
|
|
links to the current .Request.URL.Path and with all query parameters + the page
|
|
|
|
added. Should be suitable for most pagers that don't need any specialized logic.
|
|
|
|
|
|
|
|
See also: template_funcs.go for the SimplePager wrapper function.
|
|
|
|
-->
|
|
|
|
{{define "SimplePager"}}
|
2023-08-16 00:33:33 +00:00
|
|
|
{{if .Pager.Pages}}
|
2023-06-22 03:46:27 +00:00
|
|
|
<nav class="pagination" role="navigation" aria-label="pagination">
|
|
|
|
<a class="pagination-previous{{if not .Pager.HasPrevious}} is-disabled{{end}}" title="Previous"
|
|
|
|
href="{{.Request.URL.Path}}?{{QueryPlus "page" .Pager.Previous}}">Previous</a>
|
|
|
|
<a class="pagination-next{{if not .Pager.HasNext}} is-disabled{{end}}" title="Next"
|
|
|
|
href="{{.Request.URL.Path}}?{{QueryPlus "page" .Pager.Next}}">Next page</a>
|
|
|
|
<ul class="pagination-list">
|
|
|
|
{{$Root := .}}
|
|
|
|
{{range .Pager.Iter}}
|
|
|
|
<li>
|
|
|
|
<a class="pagination-link{{if .IsCurrent}} is-current{{end}}"
|
|
|
|
aria-label="Page {{.Page}}"
|
|
|
|
href="{{$Root.Request.URL.Path}}?{{QueryPlus "page" .Page}}">
|
|
|
|
{{.Page}}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{{end}}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
2023-08-16 00:33:33 +00:00
|
|
|
{{end}}
|
2023-06-22 03:46:27 +00:00
|
|
|
{{end}}
|