Ejemplo n.º 1
0
//Post Page
func (this *PostRouter) SinglePost() {
	this.TplNames = "post/post.html"

	var postMd models.Post
	if this.loadPost(&postMd, nil) {
		return
	}

	var comments []*models.Comment
	this.loadComments(&postMd, &comments)

	//mark all notification as read
	if this.IsLogin {
		models.MarkNortificationAsRead(this.User.Id, postMd.Id)
	}

	//check whether this post is favorited
	num, _ := this.User.FavoritePosts().Filter("Post__Id", postMd.Id).Filter("IsFav", true).Count()
	if num != 0 {
		this.Data["IsPostFav"] = true
	} else {
		this.Data["IsPostFav"] = false
	}

	form := post.CommentForm{}
	this.SetFormSets(&form)
	//increment PageViewCount
	post.PostBrowsersAdd(this.User.Id, this.Ctx.Input.IP(), &postMd)
}
Ejemplo n.º 2
0
func (this *PostRouter) Single() {
	this.TplName = "post/post.html"

	var postMd models.Post
	if this.loadPost(&postMd, nil) {
		return
	}

	var comments []*models.Comment
	this.loadComments(&postMd, &comments)

	form := post.CommentForm{}
	this.SetFormSets(&form)

	post.PostBrowsersAdd(this.User.Id, this.Ctx.Input.IP(), &postMd)
}