mirror of
https://github.com/Vimux/Binario.git
synced 2024-11-23 22:48:35 +00:00
Format pagination partial
This commit is contained in:
parent
1b73262d85
commit
64780c1741
1 changed files with 21 additions and 15 deletions
|
@ -3,21 +3,27 @@
|
||||||
<div class="pagination block">
|
<div class="pagination block">
|
||||||
{{- $.Scratch.Set "__paginator.ellipsed" false }}
|
{{- $.Scratch.Set "__paginator.ellipsed" false }}
|
||||||
{{- range $pag.Pagers }}
|
{{- range $pag.Pagers }}
|
||||||
{{- $right := sub .TotalPages .PageNumber }}
|
{{- $right := sub .TotalPages .PageNumber }}
|
||||||
{{- $showNumber := or (le .PageNumber 3) (eq $right 0) }}
|
{{- $showNumber := or (le .PageNumber 3) (eq $right 0) }}
|
||||||
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) }}
|
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) }}
|
||||||
{{- if $showNumber }}
|
{{- if $showNumber }}
|
||||||
{{- $.Scratch.Set "__paginator.ellipsed" false }}
|
{{- $.Scratch.Set "__paginator.ellipsed" false }}
|
||||||
{{- $.Scratch.Set "__paginator.shouldEllipse" false }}
|
{{- $.Scratch.Set "__paginator.shouldEllipse" false }}
|
||||||
{{ else }}
|
{{- else }}
|
||||||
{{- $.Scratch.Set "__paginator.shouldEllipse" (not ($.Scratch.Get "__paginator.ellipsed") ) }}
|
{{- $.Scratch.Set "__paginator.shouldEllipse" (not ($.Scratch.Get "__paginator.ellipsed") ) }}
|
||||||
{{- $.Scratch.Set "__paginator.ellipsed" true }}
|
{{- $.Scratch.Set "__paginator.ellipsed" true }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if $showNumber }}
|
{{- if $showNumber }}
|
||||||
{{- if eq . $pag }}<span class="pagination__item pagination__item--active" data-total="{{ $pag.TotalPages }}">{{ .PageNumber }}</span>{{ else }}<a class="pagination__item pagination__item--desktop" href="{{ .URL }}">{{ .PageNumber }}</a>{{- end }}
|
{{- if eq . $pag }}
|
||||||
{{ else if ($.Scratch.Get "__paginator.shouldEllipse") }}
|
<span class="pagination__item pagination__item--active" data-total="{{ $pag.TotalPages }}">
|
||||||
<span class="pagination__item pagination__item--gap">…</span>
|
{{- .PageNumber -}}
|
||||||
{{- end }}
|
</span>
|
||||||
|
{{- else }}
|
||||||
|
<a class="pagination__item pagination__item--desktop" href="{{ .URL }}">{{ .PageNumber }}</a>
|
||||||
|
{{- end }}
|
||||||
|
{{- else if ($.Scratch.Get "__paginator.shouldEllipse") }}
|
||||||
|
<span class="pagination__item pagination__item--gap">…</span>
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</div>
|
</div>
|
||||||
{{- end }}
|
{{- end }}
|
Loading…
Reference in a new issue