summaryrefslogtreecommitdiffstats
path: root/routers/home.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-07-24 14:32:46 +0800
committerUnknwon <u@gogs.io>2016-07-24 14:32:46 +0800
commite74630ae3b635a43a1bdafcf8b80d2f87b3536b6 (patch)
tree63c5fb32b6ca4417c3dfd9c05f532d5598aa4117 /routers/home.go
parent1f2e173a745da8e4b57f96b5561a3c10054d3b76 (diff)
downloadgitea-e74630ae3b635a43a1bdafcf8b80d2f87b3536b6.tar.gz
gitea-e74630ae3b635a43a1bdafcf8b80d2f87b3536b6.zip
#1384 add pagination for repositories
Diffstat (limited to 'routers/home.go')
-rw-r--r--routers/home.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/home.go b/routers/home.go
index 93b24083c7..0876e3a3d9 100644
--- a/routers/home.go
+++ b/routers/home.go
@@ -45,7 +45,7 @@ func Home(ctx *context.Context) {
}
type RepoSearchOptions struct {
- Counter func() int64
+ Counter func(bool) int64
Ranger func(int, int) ([]*models.Repository, error)
Private bool
PageSize int
@@ -55,7 +55,7 @@ type RepoSearchOptions struct {
func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
page := ctx.QueryInt("page")
- if page <= 1 {
+ if page <= 0 {
page = 1
}
@@ -72,7 +72,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
ctx.Handle(500, "opts.Ranger", err)
return
}
- count = opts.Counter()
+ count = opts.Counter(opts.Private)
} else {
repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{
Keyword: keyword,
@@ -107,7 +107,7 @@ func ExploreRepos(ctx *context.Context) {
ctx.Data["PageIsExploreRepositories"] = true
RenderRepoSearch(ctx, &RepoSearchOptions{
- Counter: models.CountPublicRepositories,
+ Counter: models.CountRepositories,
Ranger: models.GetRecentUpdatedRepositories,
PageSize: setting.UI.ExplorePagingNum,
OrderBy: "updated_unix DESC",