示例#1
0
文件: notice.go 项目: varding/wetalk
func (this *NoticeRouter) Get() {
	this.Data["IsNotificationPage"] = true
	this.TplNames = "post/notice.html"

	if this.CheckLoginRedirect() {
		return
	}

	var notifications []models.Notification
	qs := models.Notifications(this.User.Id)

	pers := 10
	count, _ := models.CountObjects(qs)
	pager := this.SetPaginator(pers, count)

	qs = qs.OrderBy("-Created").Limit(pers, pager.Offset()).RelatedSel()

	models.ListObjects(qs, &notifications)
	this.Data["Notifications"] = notifications

	var cats []models.Category
	var topics []models.Topic
	post.ListCategories(&cats)
	this.Data["Categories"] = cats
	post.ListTopics(&topics)
	this.Data["Topics"] = topics
}
示例#2
0
文件: post.go 项目: varding/wetalk
//Get all the categories
func (this *PostListRouter) setCategories(cats *[]models.Category) {
	//@see modules/post/topic_util.go
	post.ListCategories(cats)
	this.Data["Categories"] = *cats
}