Beispiel #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"
}
Beispiel #2
0
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"
}
Beispiel #3
0
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"
}