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

@ -17,8 +17,6 @@ import (
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/routers/user"
"github.com/Unknwon/paginater"
)
const (
@ -151,10 +149,13 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
}
ctx.Data["Keyword"] = keyword
ctx.Data["Total"] = count
ctx.Data["Page"] = paginater.New(int(count), opts.PageSize, page, 5)
ctx.Data["Repos"] = repos
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
pager := context.NewPagination(int(count), opts.PageSize, page, 5)
pager.SetDefaultParams(ctx)
ctx.Data["Page"] = pager
ctx.HTML(200, opts.TplName)
}
@ -222,11 +223,14 @@ func RenderUserSearch(ctx *context.Context, opts *models.SearchUserOptions, tplN
}
ctx.Data["Keyword"] = opts.Keyword
ctx.Data["Total"] = count
ctx.Data["Page"] = paginater.New(int(count), opts.PageSize, opts.Page, 5)
ctx.Data["Users"] = users
ctx.Data["ShowUserEmail"] = setting.UI.ShowUserEmail
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
pager.SetDefaultParams(ctx)
ctx.Data["Page"] = pager
ctx.HTML(200, tplName)
}
@ -364,11 +368,14 @@ func ExploreCode(ctx *context.Context) {
}
ctx.Data["Keyword"] = keyword
pager := paginater.New(total, setting.UI.RepoSearchPagingNum, page, 5)
ctx.Data["Page"] = pager
ctx.Data["SearchResults"] = searchResults
ctx.Data["RequireHighlightJS"] = true
ctx.Data["PageIsViewCode"] = true
pager := context.NewPagination(total, setting.UI.RepoSearchPagingNum, page, 5)
pager.SetDefaultParams(ctx)
ctx.Data["Page"] = pager
ctx.HTML(200, tplExploreCode)
}