Beispiel #1
0
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)
}
Beispiel #2
0
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)
}