2018-05-04 11:53:56 -04:00
|
|
|
{{ $pag := $.Paginator }}
|
2020-04-21 18:49:30 -04:00
|
|
|
{{ if gt $pag.TotalPages 1 -}}
|
2018-05-04 11:53:56 -04:00
|
|
|
<ul class="pagination">
|
2020-04-21 18:49:30 -04:00
|
|
|
{{ with $pag.First -}}
|
|
|
|
<li class="page-item">
|
|
|
|
<a href="{{ .URL }}" class="page-link" aria-label="First"><span aria-hidden="true">««</span></a>
|
|
|
|
</li>
|
|
|
|
{{ end -}}
|
|
|
|
<li class="page-item{{ if not $pag.HasPrev }} disabled{{ end }}">
|
2019-06-26 16:31:06 -04:00
|
|
|
<a {{ if $pag.HasPrev }}href="{{ $pag.Prev.URL }}"{{ end }} class="page-link" aria-label="Previous"><span aria-hidden="true">«</span></a>
|
2020-04-21 18:49:30 -04:00
|
|
|
</li>
|
|
|
|
{{- $ellipsed := false -}}
|
|
|
|
{{- $shouldEllipse := false -}}
|
|
|
|
{{- range $pag.Pagers -}}
|
|
|
|
{{- $right := sub .TotalPages .PageNumber -}}
|
2020-07-31 07:35:22 -04:00
|
|
|
{{- $showNumber := or (eq .TotalPages 5) (le .PageNumber 3) (eq $right 0) -}}
|
2020-04-21 18:49:30 -04:00
|
|
|
{{- if $showNumber -}}
|
|
|
|
{{- $ellipsed = false -}}
|
|
|
|
{{- $shouldEllipse = false -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- $shouldEllipse = not $ellipsed -}}
|
|
|
|
{{- $ellipsed = true -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if $showNumber }}
|
|
|
|
<li class="page-item{{ if eq . $pag }} active{{ end }}">
|
|
|
|
<a class="page-link" href="{{ .URL }}">{{ .PageNumber }}</a>
|
|
|
|
</li>
|
|
|
|
{{- else if $shouldEllipse }}
|
|
|
|
<li class="page-item disabled">
|
|
|
|
<span aria-hidden="true"> … </span>
|
|
|
|
</li>
|
|
|
|
{{- end -}}
|
|
|
|
{{- end }}
|
|
|
|
<li class="page-item{{ if not $pag.HasNext }} disabled{{ end }}">
|
2019-06-26 16:31:06 -04:00
|
|
|
<a {{ if $pag.HasNext }}href="{{ $pag.Next.URL }}"{{ end }} class="page-link" aria-label="Next"><span aria-hidden="true">»</span></a>
|
2020-04-21 18:49:30 -04:00
|
|
|
</li>
|
|
|
|
{{- with $pag.Last }}
|
|
|
|
<li class="page-item">
|
|
|
|
<a href="{{ .URL }}" class="page-link" aria-label="Last"><span aria-hidden="true">»»</span></a>
|
|
|
|
</li>
|
|
|
|
{{- end }}
|
2018-05-04 11:53:56 -04:00
|
|
|
</ul>
|
2019-06-26 16:31:06 -04:00
|
|
|
{{ end }}
|