diff options
author | Unknwon <u@gogs.io> | 2015-07-28 03:14:37 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-07-28 03:14:37 +0800 |
commit | 589618c8a53f11395fca3465d8ad936ad46caaf0 (patch) | |
tree | b7cf6b9085616310ad62aa4f11792858599fe3de /routers/repo/issue.go | |
parent | 31f6069dbe95cf54de50accca500e9fb95dd2f47 (diff) | |
download | gitea-589618c8a53f11395fca3465d8ad936ad46caaf0.tar.gz gitea-589618c8a53f11395fca3465d8ad936ad46caaf0.zip |
better paging
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r-- | routers/repo/issue.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 79f8e36353..6adf964926 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -15,6 +15,7 @@ import ( "time" "github.com/Unknwon/com" + "github.com/Unknwon/paginater" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" @@ -100,13 +101,15 @@ func Issues(ctx *middleware.Context) { page := ctx.QueryInt("page") if page <= 1 { page = 1 - } else { - ctx.Data["PreviousPage"] = page - 1 } - if (!isShowClosed && int(issueStats.OpenCount) > setting.IssuePagingNum*page) || - (isShowClosed && int(issueStats.ClosedCount) > setting.IssuePagingNum*page) { - ctx.Data["NextPage"] = page + 1 + + var total int + if !isShowClosed { + total = int(issueStats.OpenCount) + } else { + total = int(issueStats.ClosedCount) } + ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5) // Get issues. issues, err := models.GetIssues(uid, assigneeID, repo.Id, posterID, milestoneID, |