2020-02-24 10:00:39 +01:00
|
|
|
{{- if gt .Paginator.TotalPages 1 -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
<ul class="pagination">
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- .Scratch.Set "paginator.ellipsed" false -}}
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- range $.Paginator.Pagers -}}
|
|
|
|
{{- $right := sub .TotalPages .PageNumber -}}
|
|
|
|
{{- $showNumber := or (le .PageNumber 1) (eq $right 0) -}}
|
|
|
|
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $.Paginator.PageNumber 3)) (lt .PageNumber (add $.Paginator.PageNumber 3))) -}}
|
|
|
|
{{- if $showNumber -}}
|
|
|
|
{{- $.Scratch.Set "paginator.ellipsed" false -}}
|
|
|
|
{{- $.Scratch.Set "paginator.shouldEllipse" false -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- $.Scratch.Set "paginator.shouldEllipse" (not ($.Scratch.Get "paginator.ellipsed") ) -}}
|
|
|
|
{{- $.Scratch.Set "paginator.ellipsed" true -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if $showNumber -}}
|
2019-11-23 06:52:41 +01:00
|
|
|
<li class="page-item {{ if eq . $.Paginator }}active{{ end }}">
|
2019-08-04 15:53:35 +02:00
|
|
|
<span class="page-link">
|
2020-01-31 15:53:04 +01:00
|
|
|
<a href="{{ .URL }}">
|
|
|
|
{{- .PageNumber -}}
|
|
|
|
</a>
|
2019-08-04 15:53:35 +02:00
|
|
|
</span>
|
|
|
|
</li>
|
2019-11-23 06:42:26 +01:00
|
|
|
{{- else if ($.Scratch.Get "paginator.shouldEllipse") -}}
|
2020-01-31 15:53:04 +01:00
|
|
|
<li class="page-item ">
|
|
|
|
<span class="page-link" aria-hidden="true">…</span>
|
|
|
|
</li>
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
</ul>
|
2020-02-06 17:10:00 +01:00
|
|
|
{{- end -}}
|