diff options
author | Antoine GIRARD <sapk@sapk.fr> | 2015-09-25 18:13:38 +0200 |
---|---|---|
committer | Antoine GIRARD <sapk@sapk.fr> | 2015-09-25 18:13:38 +0200 |
commit | 14a11011390000cc21d134c3e612dda0fb9f490c (patch) | |
tree | d059e810efbb0b218b88ff719a84d8b10d9c6fb8 /models/admin.go | |
parent | 4f8b20995694a21cdde1c2be3b86de8186fe3f42 (diff) | |
download | gitea-14a11011390000cc21d134c3e612dda0fb9f490c.tar.gz gitea-14a11011390000cc21d134c3e612dda0fb9f490c.zip |
New admin notice UI based on user list example
Diffstat (limited to 'models/admin.go')
-rw-r--r-- | models/admin.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/models/admin.go b/models/admin.go index 493cc7afc8..e24e0026b8 100644 --- a/models/admin.go +++ b/models/admin.go @@ -50,11 +50,10 @@ func CountNotices() int64 { return count } -// GetNotices returns given number of notices with offset. -func GetNotices(num, offset int) ([]*Notice, error) { - notices := make([]*Notice, 0, num) - err := x.Limit(num, offset).Desc("id").Find(¬ices) - return notices, err +// Notices returns number of notices in given page. +func Notices(page, pageSize int) ([]*Notice, error) { + notices := make([]*Notice, 0, pageSize) + return notices, x.Limit(pageSize, (page-1)*pageSize).Desc("id").Find(¬ices) } // DeleteNotice deletes a system notice by given ID. |