mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-12-01 12:41:47 +01:00
50 lines
2.2 KiB
HTML
50 lines
2.2 KiB
HTML
|
{{ $pag := $.Paginator }}
|
||
|
{{ if gt $pag.TotalPages 1 }}
|
||
|
<ul class="pagination">
|
||
|
{{ with $pag.First }}
|
||
|
<!-- <li class="page-item {{ if not $pag.HasPrev }}disabled{{ end }}">
|
||
|
<span class="page-link">
|
||
|
<a href="{{ .URL }}" aria-label="First"><span aria-hidden="true">««</span></a>
|
||
|
</span>
|
||
|
</li> -->
|
||
|
{{ end }}
|
||
|
<!-- <li class="page-item {{ if not $pag.HasPrev }}disabled{{ end }}">
|
||
|
<span class="page-link">
|
||
|
<a href="{{ if $pag.HasPrev }}{{ $pag.Prev.URL }}{{ end }}" aria-label="Previous"><span aria-hidden="true">«</span></a>
|
||
|
</span>
|
||
|
</li> -->
|
||
|
{{ $.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 }}
|
||
|
<!-- <li class="page-item {{ if not $pag.HasNext }}disabled{{ end }}">
|
||
|
<span class="page-link">
|
||
|
<a href="{{ if $pag.HasNext }}{{ $pag.Next.URL }}{{ end }}" aria-label="Next"><span aria-hidden="true">»</span></a>
|
||
|
</span>
|
||
|
</li> -->
|
||
|
<!-- {{ with $pag.Last }}
|
||
|
<li class="page-item {{ if not $pag.HasNext }}disabled{{ end }}">
|
||
|
<span class="page-link">
|
||
|
<a href="{{ .URL }}" aria-label="Last"><span aria-hidden="true">»»</span></a>
|
||
|
</span>
|
||
|
</li>
|
||
|
{{ end }} -->
|
||
|
</ul>
|
||
|
{{ end }}
|