Example #1
0
func PermitBlog(ctx *middleware.Context, params martini.Params) {
	id := params["id"]
	blog := new(model.Blog)
	blog.Id = ParseInt(id)
	err := blog.Forbid(false)
	PanicIf(err)
	ctx.Set("success", true)
	ctx.JSON(200, ctx.Response)
}
Example #2
0
func EditBlog(ctx *middleware.Context, params martini.Params) {
	id := params["id"]
	blog := new(model.Blog)
	blog.Id = ParseInt(id)
	err := blog.GetBlog()
	PanicIf(err)
	ctx.Set("Blog", blog)

	tags, err := blog.GetAllTags()
	PanicIf(err)
	ctx.Set("Tags", tags)

	ctx.HTML(200, "blog/edit", ctx)
}