File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 2
2
{{$paginationLink := $.Link}}
3
3
{{if eq $paginationLink AppSubUrl}}{{$paginationLink = print $paginationLink "/"}}{{end}}
4
4
{{with .Page.Paginater}}
5
- {{if .TotalPages}}
6
- {{$showFirstLast := gt .TotalPages 0 }}
5
+ {{if or (eq .TotalPages -1) (gt .TotalPages 1) }}
6
+ {{$showFirstLast := gt .TotalPages 1 }}
7
7
<div class="center page buttons">
8
8
<div class="ui borderless pagination menu">
9
9
{{if $showFirstLast}}
17
17
{{svg "octicon-chevron-left" 16 "tw-mr-1"}}
18
18
<span class="navigation_label">{{ctx.Locale.Tr "repo.issues.previous"}}</span>
19
19
</a>
20
- {{range .Pages}}
20
+ {{$pages := .Pages}}
21
+ {{$pagesLen := len $pages}}
22
+ {{range $pages}}
21
23
{{if eq .Num -1}}
22
24
<a class="disabled item">...</a>
23
25
{{else}}
24
- <a class="{{if .IsCurrent}}active {{end}}item" {{if not .IsCurrent}}href="{{$paginationLink}}?page={{.Num}}{{if $paginationParams}}&{{$paginationParams}}{{end}}"{{end}}>{{.Num}}</a>
26
+ {{/* do not highlight the current page if there is only one page */}}
27
+ <a class="{{if and .IsCurrent (gt $pagesLen 1)}}active {{end}}item" {{if not .IsCurrent}}href="{{$paginationLink}}?page={{.Num}}{{if $paginationParams}}&{{$paginationParams}}{{end}}"{{end}}>{{.Num}}</a>
25
28
{{end}}
26
29
{{end}}
27
30
<a class="{{if not .HasNext}}disabled{{end}} item navigation" {{if .HasNext}}href="{{$paginationLink}}?page={{.Next}}{{if $paginationParams}}&{{$paginationParams}}{{end}}"{{end}}>
You can’t perform that action at this time.
0 commit comments