forked from kevadesu/forgejo
#1689 minor fixes and update locale
This commit is contained in:
parent
1c35380c2c
commit
0d5e57e4ae
3 changed files with 18 additions and 18 deletions
|
@ -5,7 +5,6 @@
|
|||
package admin
|
||||
|
||||
import (
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/Unknwon/paginater"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
|
@ -24,25 +23,26 @@ func Notices(ctx *middleware.Context) {
|
|||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminNotices"] = true
|
||||
|
||||
total := models.CountNotices()
|
||||
total := models.CountNotices()
|
||||
page := ctx.QueryInt("page")
|
||||
if page <= 1 {
|
||||
page = 1
|
||||
}
|
||||
ctx.Data["Page"] = paginater.New(int(total), setting.AdminNoticePagingNum, page, 5)
|
||||
|
||||
notices, err := models.Notices(page, setting.AdminNoticePagingNum)
|
||||
|
||||
notices, err := models.Notices(page, setting.AdminNoticePagingNum)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "Notices", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Notices"] = notices
|
||||
|
||||
ctx.Data["Total"] = total
|
||||
ctx.HTML(200, NOTICES)
|
||||
}
|
||||
|
||||
func DeleteNotice(ctx *middleware.Context) {
|
||||
id := com.StrTo(ctx.Params(":id")).MustInt64()
|
||||
id := ctx.ParamsInt64(":id")
|
||||
if err := models.DeleteNotice(id); err != nil {
|
||||
ctx.Handle(500, "DeleteNotice", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue