summaryrefslogtreecommitdiffstats
path: root/routers/repo/commit.go
diff options
context:
space:
mode:
authorMario Lubenka <mario.lubenka@googlemail.com>2019-04-20 06:15:19 +0200
committertechknowlogick <matti@mdranta.net>2019-04-20 00:15:19 -0400
commitfcbac38d6fd8c91be0da5e7f37e7bc69b071253a (patch)
treecdf7c901df75d0d2f26567d1090ed0e3c1af138d /routers/repo/commit.go
parent40dc458bb69f9827e804e2fe51c9f42caf3d3ddc (diff)
downloadgitea-fcbac38d6fd8c91be0da5e7f37e7bc69b071253a.tar.gz
gitea-fcbac38d6fd8c91be0da5e7f37e7bc69b071253a.zip
Unifies pagination template usage (#6531) (#6533)
Diffstat (limited to 'routers/repo/commit.go')
-rw-r--r--routers/repo/commit.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 9263bcac7f..2978eda6c0 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -1,4 +1,5 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
+// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
@@ -14,8 +15,6 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
-
- "github.com/Unknwon/paginater"
)
const (
@@ -55,7 +54,6 @@ func Commits(ctx *context.Context) {
if page <= 1 {
page = 1
}
- ctx.Data["Page"] = paginater.New(int(commitsCount), git.CommitsRangeSize, page, 5)
// Both `git log branchName` and `git log commitId` work.
commits, err := ctx.Repo.Commit.CommitsByRange(page)
@@ -72,6 +70,11 @@ func Commits(ctx *context.Context) {
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
ctx.Data["CommitCount"] = commitsCount
ctx.Data["Branch"] = ctx.Repo.BranchName
+
+ pager := context.NewPagination(int(commitsCount), git.CommitsRangeSize, page, 5)
+ pager.SetDefaultParams(ctx)
+ ctx.Data["Page"] = pager
+
ctx.HTML(200, tplCommits)
}
@@ -160,7 +163,6 @@ func FileHistory(ctx *context.Context) {
if page <= 1 {
page = 1
}
- ctx.Data["Page"] = paginater.New(int(commitsCount), git.CommitsRangeSize, page, 5)
commits, err := ctx.Repo.GitRepo.CommitsByFileAndRange(branchName, fileName, page)
if err != nil {
@@ -177,6 +179,11 @@ func FileHistory(ctx *context.Context) {
ctx.Data["FileName"] = fileName
ctx.Data["CommitCount"] = commitsCount
ctx.Data["Branch"] = branchName
+
+ pager := context.NewPagination(int(commitsCount), git.CommitsRangeSize, page, 5)
+ pager.SetDefaultParams(ctx)
+ ctx.Data["Page"] = pager
+
ctx.HTML(200, tplCommits)
}