diff options
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/tplimpl/embedded/templates.autogen.go | 13 | ||||
-rw-r--r-- | tpl/tplimpl/embedded/templates/pagination.html | 13 |
2 files changed, 14 insertions, 12 deletions
diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go index d55e5b307..89078350e 100644 --- a/tpl/tplimpl/embedded/templates.autogen.go +++ b/tpl/tplimpl/embedded/templates.autogen.go @@ -239,21 +239,22 @@ if (!doNotTrack) { <li class="page-item{{ if not $pag.HasPrev }} disabled{{ end }}"> <a href="{{ if $pag.HasPrev }}{{ $pag.Prev.URL }}{{ end }}" class="page-link" aria-label="Previous"><span aria-hidden="true">«</span></a> </li> - {{ $.Scratch.Set "__paginator.ellipsed" false }} + {{ $ellipsed := false }} + {{ $shouldEllipse := false }} {{ range $pag.Pagers }} {{ $right := sub .TotalPages .PageNumber }} {{ $showNumber := or (le .PageNumber 3) (eq $right 0) }} {{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) }} {{ if $showNumber }} - {{ $.Scratch.Set "__paginator.ellipsed" false }} - {{ $.Scratch.Set "__paginator.shouldEllipse" false }} + {{ $ellipsed = false }} + {{ $shouldEllipse = false }} {{ else }} - {{ $.Scratch.Set "__paginator.shouldEllipse" (not ($.Scratch.Get "__paginator.ellipsed") ) }} - {{ $.Scratch.Set "__paginator.ellipsed" true }} + {{ $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 ($.Scratch.Get "__paginator.shouldEllipse") }} + {{ else if $shouldEllipse }} <li class="page-item disabled"><span aria-hidden="true"> … </span></li> {{ end }} {{ end }} diff --git a/tpl/tplimpl/embedded/templates/pagination.html b/tpl/tplimpl/embedded/templates/pagination.html index 7995061d9..1c2d2d82f 100644 --- a/tpl/tplimpl/embedded/templates/pagination.html +++ b/tpl/tplimpl/embedded/templates/pagination.html @@ -9,21 +9,22 @@ <li class="page-item{{ if not $pag.HasPrev }} disabled{{ end }}"> <a href="{{ if $pag.HasPrev }}{{ $pag.Prev.URL }}{{ end }}" class="page-link" aria-label="Previous"><span aria-hidden="true">«</span></a> </li> - {{ $.Scratch.Set "__paginator.ellipsed" false }} + {{ $ellipsed := false }} + {{ $shouldEllipse := false }} {{ range $pag.Pagers }} {{ $right := sub .TotalPages .PageNumber }} {{ $showNumber := or (le .PageNumber 3) (eq $right 0) }} {{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) }} {{ if $showNumber }} - {{ $.Scratch.Set "__paginator.ellipsed" false }} - {{ $.Scratch.Set "__paginator.shouldEllipse" false }} + {{ $ellipsed = false }} + {{ $shouldEllipse = false }} {{ else }} - {{ $.Scratch.Set "__paginator.shouldEllipse" (not ($.Scratch.Get "__paginator.ellipsed") ) }} - {{ $.Scratch.Set "__paginator.ellipsed" true }} + {{ $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 ($.Scratch.Get "__paginator.shouldEllipse") }} + {{ else if $shouldEllipse }} <li class="page-item disabled"><span aria-hidden="true"> … </span></li> {{ end }} {{ end }} |