func Forks(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repos.forks")
- // TODO: need pagination
- forks, err := ctx.Repo.Repository.GetForks(db.ListOptions{})
+ page := ctx.FormInt("page")
+ if page <= 0 {
+ page = 1
+ }
+
+ pager := context.NewPagination(ctx.Repo.Repository.NumForks, models.ItemsPerPage, page, 5)
+ ctx.Data["Page"] = pager
+
+ forks, err := ctx.Repo.Repository.GetForks(db.ListOptions{
+ Page: pager.Paginater.Current(),
+ PageSize: models.ItemsPerPage,
+ })
if err != nil {
ctx.ServerError("GetForks", err)
return
return
}
}
+
ctx.Data["Forks"] = forks
ctx.HTML(http.StatusOK, tplForks)