aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-09-25 12:53:18 -0400
committer无闻 <u@gogs.io>2015-09-25 12:53:18 -0400
commit1c35380c2c476e8eb5022078262e8cadade4d4c7 (patch)
treed4ee03e2655e96b8ea87bfb21a58591bbd293b65 /models
parent4f8b20995694a21cdde1c2be3b86de8186fe3f42 (diff)
parent3544dafb649c798736991f813593c10584e18e34 (diff)
Merge pull request #1689 from sapk/fix-admin-notice-new-ui
New admin notice UI based on user list example
Diffstat (limited to 'models')
-rw-r--r--models/admin.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/models/admin.go b/models/admin.go
index 493cc7af..e24e0026 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(&notices)
- 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(&notices)
}
// DeleteNotice deletes a system notice by given ID.