예제 #1
0
파일: admin.go 프로젝트: jango2015/Blog-3
func (this *AdminController) Entry() {
	checkLogin(this)
	this.TplNames = "admin/entry.tpl"

	eid := this.Ctx.Input.Param(":id")
	fmt.Println(eid)
	if eid != "new" {
		entry, _ := models.EntryById(eid)
		if entry == nil {
			this.Abort("404")
			return
		} else {
			this.Data["Entry"] = entry
			this.Data["PostId"] = "update/" + entry.Id
		}
	}

	this.Data["EntryActive"] = true
	this.Data["MarkdownEnabled"] = true

	collections, err := models.CollectionsByUser(this.GetSession("user").(string))
	if err != nil {
		panic(err)
	}
	this.Data["Collections"] = collections
	fmt.Println(this.Data["Entry"])

	renderTemplate(this.Ctx, "views/admin/entry.amber", this.Data)
}
예제 #2
0
파일: front.go 프로젝트: jango2015/Blog-3
func (this *FrontController) Entry() {
	eid := this.Ctx.Input.Param(":id")
	entry, _ := models.EntryById(eid)
	// fmt.Println(entry)

	this.TplNames = "entry.tpl"

	// fmt.Println(entry.Content)
	this.Data["Entry"] = entry
	this.Data["Title"] = entry.Title
	this.Data["Subtitle"] = entry.Subtitle
	this.Data["MarkdownEnabled"] = true

	renderTemplate(this.Ctx, "views/entry.amber", this.Data)
}