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"
|
2024-07-07 19:45:42 +00:00
|
|
|
href="{{.Request.URL.Path}}?{{QueryPlus "page" .Pager.Previous}}"
|
|
|
|
style="font-size: smaller">Previous</a>
|
2023-06-22 03:46:27 +00:00
|
|
|
<a class="pagination-next{{if not .Pager.HasNext}} is-disabled{{end}}" title="Next"
|
2024-07-07 19:45:42 +00:00
|
|
|
href="{{.Request.URL.Path}}?{{QueryPlus "page" .Pager.Next}}"
|
|
|
|
style="font-size: smaller">Next page</a>
|
2023-06-22 03:46:27 +00:00
|
|
|
<ul class="pagination-list">
|
|
|
|
{{$Root := .}}
|
2024-07-07 19:45:42 +00:00
|
|
|
{{$DropdownID := .Pager.UniqueSerialID}}
|
2023-06-22 03:46:27 +00:00
|
|
|
{{range .Pager.Iter}}
|
|
|
|
<li>
|
2024-07-07 19:45:42 +00:00
|
|
|
<!-- Overflow menu in the middle? -->
|
|
|
|
{{if .IsOverflow}}
|
|
|
|
<div class="dropdown px-1">
|
|
|
|
<div class="dropdown-trigger">
|
2024-07-08 18:00:23 +00:00
|
|
|
<button type="button" class="button{{if .IsCurrent}} is-link{{end}}" aria-haspopup="true" aria-controls="{{$DropdownID}}" style="font-size: smaller">
|
2024-07-07 19:45:42 +00:00
|
|
|
{{.Page}} <i class="fas fa-angle-down ml-1" aria-hidden="true"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="dropdown-menu" id="{{$DropdownID}}" role="menu">
|
|
|
|
<div class="dropdown-content" style="max-height: 250px; overflow: auto">
|
|
|
|
{{range .IterOverflow}}
|
|
|
|
<a class="dropdown-item{{if .IsCurrent}} is-active{{end}}"
|
|
|
|
aria-label="Page {{.Page}}"
|
|
|
|
href="{{$Root.Request.URL.Path}}?{{QueryPlus "page" .Page}}">{{.Page}}</a>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{else}}
|
2023-06-22 03:46:27 +00:00
|
|
|
<a class="pagination-link{{if .IsCurrent}} is-current{{end}}"
|
2024-07-07 19:45:42 +00:00
|
|
|
style="font-size: smaller"
|
2023-06-22 03:46:27 +00:00
|
|
|
aria-label="Page {{.Page}}"
|
|
|
|
href="{{$Root.Request.URL.Path}}?{{QueryPlus "page" .Page}}">
|
|
|
|
{{.Page}}
|
|
|
|
</a>
|
2024-07-07 19:45:42 +00:00
|
|
|
{{end}}
|
2023-06-22 03:46:27 +00:00
|
|
|
</li>
|
|
|
|
{{end}}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
2023-08-16 00:33:33 +00:00
|
|
|
{{end}}
|
2023-06-22 03:46:27 +00:00
|
|
|
{{end}}
|