示例#1
0
func (this *AdminTopicController) Edit() {

	id := this.Input().Get("id")

	if len(id) == 0 {
		return
	}

	var err error
	this.Data["Topic"], err = models.GetOneTopic(id)

	if err != nil {
		beego.Error(err)
	}

	this.Data["Categories"], err = models.GetAllCategories()

	if err != nil {
		beego.Error(err)
	}

	this.Data["PageTitle"] = "Eidt Topic"
	this.Data["IsTopic"] = true
	this.Layout = "layout/admin_layout.tpl"
	this.TplNames = "admin_topic/edit.tpl"
}
示例#2
0
文件: topic.go 项目: Hevi-Ye/blog
func (this *TopicController) Modify() {
	id := this.Ctx.Input.Params["0"]
	topic, err := models.GetOneTopic(id)
	if err != nil {
		beego.Error(err)
	}
	this.Data["Topic"] = topic
	this.TplNames = "topic_modify.html"
}
示例#3
0
文件: topic.go 项目: Hevi-Ye/blog
func (this *TopicController) View() {
	id := this.Ctx.Input.Params["0"]
	var err error
	this.Data["Topic"], err = models.GetOneTopic(id)
	if err != nil {
		beego.Error(err)
	}
	this.Data["Replies"], err = models.GetReplies(id)
	if err != nil {
		beego.Error(err)
	}
	this.Data["IsLogin"] = CheckAccount(this.Ctx)
	this.TplNames = "topic_view.html"
}