summaryrefslogtreecommitdiffstats
path: root/routers/home.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-01 07:04:35 -0400
committerUnknwon <u@gogs.io>2015-09-01 07:04:35 -0400
commit7714e792a4ff5b179c24b1db35a5d452716c47f0 (patch)
treee0b0a08395de1d7400faba2d2d303b5d333c8730 /routers/home.go
parent67f07e21f55c599eb335806e054b7d40d28b4e3e (diff)
downloadgitea-7714e792a4ff5b179c24b1db35a5d452716c47f0.tar.gz
gitea-7714e792a4ff5b179c24b1db35a5d452716c47f0.zip
minor fixes on #1551
Diffstat (limited to 'routers/home.go')
-rw-r--r--routers/home.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/routers/home.go b/routers/home.go
index 14a123f10b..73324d4587 100644
--- a/routers/home.go
+++ b/routers/home.go
@@ -7,6 +7,8 @@ package routers
import (
"fmt"
+ "github.com/Unknwon/paginater"
+
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/middleware"
@@ -50,7 +52,14 @@ func Explore(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("explore")
ctx.Data["PageIsExploreRepositories"] = true
- repos, err := models.GetRecentUpdatedRepositories(20)
+ page := ctx.QueryInt("page")
+ if page <= 1 {
+ page = 1
+ }
+
+ ctx.Data["Page"] = paginater.New(int(models.CountRepositories()), setting.ExplorePagingNum, page, 5)
+
+ repos, err := models.GetRecentUpdatedRepositories(page)
if err != nil {
ctx.Handle(500, "GetRecentUpdatedRepositories", err)
return