aboutsummaryrefslogtreecommitdiff
path: root/templates/repo/commits_table.tmpl
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-02-18 18:37:47 -0500
committerUnknwon <u@gogs.io>2017-02-18 18:37:47 -0500
commitc69900325d3b2d5eb7584512547fdc567bf6df91 (patch)
tree3e276a812d99eff360afe4ed614ad28cfad2c5c9 /templates/repo/commits_table.tmpl
parent685737b8168ea4cf23410d5adf83fcb0ed581467 (diff)
commits: able to specify pageSize dynamically (#3965)
Usage: <url>?page={page}&pageSize={pageSize} Also avoid/removed getting total commits count for pagination, users are only allowed navigation by 'newer' and 'older'.
Diffstat (limited to 'templates/repo/commits_table.tmpl')
-rw-r--r--templates/repo/commits_table.tmpl36
1 files changed, 15 insertions, 21 deletions
diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl
index 03e8591f..1b26572b 100644
--- a/templates/repo/commits_table.tmpl
+++ b/templates/repo/commits_table.tmpl
@@ -1,5 +1,9 @@
<h4 class="ui top attached header">
- {{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}} {{if .Branch}}({{.Branch}}){{end}}
+ {{if .PageIsCommits}}
+ {{.i18n.Tr "repo.commits.commit_history"}}
+ {{else}}
+ {{.CommitsCount}} {{.i18n.Tr "repo.commits.commits"}}
+ {{end}}
{{if .PageIsCommits}}
<div class="ui right">
<form action="{{.RepoLink}}/commits/{{.BranchName}}/search">
@@ -48,24 +52,14 @@
</div>
{{end}}
-{{with .Page}}
- {{if gt .TotalPages 1}}
- <div class="center page buttons">
- <div class="ui borderless pagination menu">
- <a class="{{if not .HasPrevious}}disabled{{end}} item" {{if .HasPrevious}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Previous}}"{{end}}>
- <i class="left arrow icon"></i> {{$.i18n.Tr "repo.issues.previous"}}
- </a>
- {{range .Pages}}
- {{if eq .Num -1}}
- <a class="disabled item">...</a>
- {{else}}
- <a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Num}}"{{end}}>{{.Num}}</a>
- {{end}}
- {{end}}
- <a class="{{if not .HasNext}}disabled{{end}} item" {{if .HasNext}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Next}}"{{end}}>
- {{$.i18n.Tr "repo.issues.next"}} <i class="icon right arrow"></i>
- </a>
- </div>
- </div>
- {{end}}
+{{if or .HasPrevious .HasNext}}
+ <br>
+ <div class="center">
+ <a class="ui small button {{if not .HasPrevious}}disabled{{end}}" {{if .HasPrevious}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.PreviousPage}}&pageSize={{.PageSize}}"{{end}}>
+ {{$.i18n.Tr "repo.commits.newer"}}
+ </a>
+ <a class="ui small button {{if not .HasNext}}disabled{{end}}" {{if .HasNext}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.NextPage}}&pageSize={{.PageSize}}"{{end}}>
+ {{$.i18n.Tr "repo.commits.older"}}
+ </a>
+ </div>
{{end}}