Example #1
0
File: posts.go Project: pjvds/acvte
func (c Posts) Show(slug string) revel.Result {
	post := new(models.Post)
	db.Db.WhereEqual("slug", slug).Limit(1).Find(post)

	post.NextPost = c.NextPost(post)
	post.PrevPost = c.PrevPost(post)

	return c.Render(post)
}
Example #2
0
File: admin.go Project: pjvds/acvte
func (c Admin) Update(p *models.Post) revel.Result {
	p.Validate(c.Validation)

	// Handle errors
	if c.Validation.HasErrors() {
		c.Validation.Keep()
		c.FlashParams()
	}

	return c.RenderJson(p)
}