2021-05-21 14:53:35 +02:00
|
|
|
{{ $pag := $.Paginator }}
|
|
|
|
{{ if gt $pag.TotalPages 1 -}}
|
2021-05-24 23:53:06 +02:00
|
|
|
<nav class="my-5 pagination is-centered" role="navigation" aria-label="pagination">
|
2021-05-21 14:53:35 +02:00
|
|
|
{{ with $pag.First -}}
|
2021-05-21 21:09:28 +02:00
|
|
|
<ul class="pagination-list">
|
2021-05-21 14:53:35 +02:00
|
|
|
{{ end -}}
|
|
|
|
{{- $ellipsed := false -}}
|
|
|
|
{{- $shouldEllipse := false -}}
|
|
|
|
{{- range $pag.Pagers -}}
|
|
|
|
{{- $right := sub .TotalPages .PageNumber -}}
|
2021-05-21 21:09:28 +02:00
|
|
|
{{- $showNumber := or (le .PageNumber 1) (eq $right 0) -}}
|
2021-05-21 14:53:35 +02:00
|
|
|
{{- $showNumber := or $showNumber (le .TotalPages 5) -}}{{/* Issue #7523 */}}
|
2021-05-21 21:09:28 +02:00
|
|
|
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 3)) (lt .PageNumber (add $pag.PageNumber 3))) -}}
|
2021-05-21 14:53:35 +02:00
|
|
|
{{- if $showNumber -}}
|
|
|
|
{{- $ellipsed = false -}}
|
|
|
|
{{- $shouldEllipse = false -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- $shouldEllipse = not $ellipsed -}}
|
|
|
|
{{- $ellipsed = true -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if $showNumber }}
|
2021-05-21 21:09:28 +02:00
|
|
|
<li>
|
2021-05-24 23:53:06 +02:00
|
|
|
<a class="mx-1 pagination-link{{ if eq . $pag }} is-current{{ end }}" href="{{ .URL }}" aria-label="Page {{ .PageNumber }}">{{ .PageNumber }}</a>
|
2021-05-21 14:53:35 +02:00
|
|
|
</li>
|
|
|
|
{{- else if $shouldEllipse }}
|
2021-05-21 21:09:28 +02:00
|
|
|
<li>
|
|
|
|
<span class="pagination-ellipsis">…</span>
|
2021-05-21 14:53:35 +02:00
|
|
|
</li>
|
|
|
|
{{- end -}}
|
|
|
|
{{- end }}
|
|
|
|
{{- with $pag.Last }}
|
|
|
|
{{- end }}
|
2021-05-21 21:09:28 +02:00
|
|
|
</ul>
|
|
|
|
</nav>
|
2021-05-21 14:53:35 +02:00
|
|
|
{{ end }}
|