mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-29 11:42:48 +01:00
29 lines
No EOL
1.1 KiB
HTML
29 lines
No EOL
1.1 KiB
HTML
{{ $pag := $.Paginator }}
|
|
{{ if gt $pag.TotalPages 1 }}
|
|
<ul class="pagination">
|
|
{{ with $pag.First }}
|
|
{{ end }}
|
|
|
|
{{ $.Scratch.Set "__paginator.ellipsed" false }}
|
|
{{ range $pag.Pagers }}
|
|
{{ $right := sub .TotalPages .PageNumber }}
|
|
{{ $showNumber := or (le .PageNumber 1) (eq $right 0) }}
|
|
{{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 3)) (lt .PageNumber (add $pag.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 . $pag }}active{{ end }}">
|
|
<span class="page-link">
|
|
<a href="{{ .URL }}">{{ .PageNumber }}</a></li>
|
|
</span>
|
|
{{ else if ($.Scratch.Get "__paginator.shouldEllipse") }}
|
|
<li class="page-item "><span class="page-link" aria-hidden="true">…</span></li>
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
{{ end }} |