mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-25 16:26:36 +01:00
26 lines
No EOL
1.3 KiB
HTML
26 lines
No EOL
1.3 KiB
HTML
{{ if gt $.paginator.TotalPages 1 -}}
|
|
<ul class="pagination">
|
|
{{- $.Scratch.Set "paginator.ellipsed" false -}}
|
|
{{ 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 -}}
|
|
<li class="page-item {{ if eq . $.paginator }}active{{ end }}">
|
|
<span class="page-link">
|
|
<a href="{{ .URL }}">{{ .PageNumber }}</a>
|
|
</span>
|
|
</li>
|
|
{{- else if ($.Scratch.Get "paginator.shouldEllipse") -}}
|
|
<li class="page-item "><span class="page-link" aria-hidden="true">…</span></li>
|
|
{{ end -}}
|
|
{{ end -}}
|
|
</ul>
|
|
{{- end }} |