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

@ -1,18 +1,18 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package admin
import (
"github.com/Unknwon/com"
"github.com/Unknwon/paginater"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"github.com/Unknwon/com"
)
const (
@ -30,7 +30,6 @@ func Notices(ctx *context.Context) {
if page <= 1 {
page = 1
}
ctx.Data["Page"] = paginater.New(int(total), setting.UI.Admin.NoticePagingNum, page, 5)
notices, err := models.Notices(page, setting.UI.Admin.NoticePagingNum)
if err != nil {
@ -40,6 +39,9 @@ func Notices(ctx *context.Context) {
ctx.Data["Notices"] = notices
ctx.Data["Total"] = total
ctx.Data["Page"] = context.NewPagination(int(total), setting.UI.Admin.NoticePagingNum, page, 5)
ctx.HTML(200, tplNotices)
}