1
0
Fork 0
forked from forgejo/forgejo

Unifies pagination template usage (#6531) (#6533)

This commit is contained in:
Mario Lubenka 2019-04-20 06:15:19 +02:00 committed by techknowlogick
parent 40dc458bb6
commit fcbac38d6f
21 changed files with 165 additions and 196 deletions

View file

@ -24,8 +24,6 @@ import (
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/templates"
"github.com/Unknwon/paginater"
)
const (
@ -462,10 +460,10 @@ func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*
if page <= 0 {
page = 1
}
pager := paginater.New(total, models.ItemsPerPage, page, 5)
pager := context.NewPagination(total, models.ItemsPerPage, page, 5)
ctx.Data["Page"] = pager
items, err := getter(pager.Current())
items, err := getter(pager.Paginater.Current())
if err != nil {
ctx.ServerError("getter", err)
return
@ -480,6 +478,7 @@ func Watchers(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.watchers")
ctx.Data["CardsTitle"] = ctx.Tr("repo.watchers")
ctx.Data["PageIsWatchers"] = true
RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, tplWatchers)
}