Ejemplo n.º 1
0
func (this *TopicController) View() {
	this.TplNames = "topic_view.html"

	topic, err := models.GetTopic(this.Ctx.Input.Param("0"))

	if err != nil {
		beego.Error(err)
		this.Redirect("/", 302)
		return
	}
	this.Data["Topic"] = topic
	this.Data["Labels"] = strings.Split(topic.Labels, " ")
	this.Data["Tid"] = this.Ctx.Input.Param("0")

	replies, err := models.GetAllReplies(this.Ctx.Input.Param("0"))
	if err != nil {
		beego.Error(err)
		return
	}
	this.Data["Replies"] = replies
	this.Data["IsLogin"] = checkAccount(this.Ctx)

	categories, err := models.GetAllCategory()
	if err != nil {
		beego.Error(err)
	}
	this.Data["Categories"] = categories
}
Ejemplo n.º 2
0
func (this *TopicController) View() {
	this.TplNames = "topicView.html"
	topic, err := models.GetTopic(this.Ctx.Input.Param("0"))
	if err != nil {
		beego.Error(err)
		this.Redirect("/", 302)
		return
	}
	this.Data["Topic"] = topic
}
Ejemplo n.º 3
0
func (this *TopicController) Modify() {
	this.TplNames = "topic_modify.html"
	tid := this.Input().Get("tid")

	topic, err := models.GetTopic(tid)

	if err != nil {
		beego.Error(err)
		this.Redirect("/", 302)
		return
	}
	this.Data["Topic"] = topic
	this.Data["Tid"] = tid
}
Ejemplo n.º 4
0
func (this *TopicController) View() {

	this.TplName = "topic_view.html"
	tId := this.Ctx.Input.Param("0")
	topic, err := models.GetTopic(tId)
	//	fmt.Println(topic)
	//	return
	if err != nil {
		beego.Error(err)
		this.Redirect("/", 302)
		return
	}
	this.Data["Topic"] = topic
	this.Data["tId"] = tId //this.Ctx.Input.Param("0")
	this.Data["IsLogin"] = checkAccount(this.Ctx)

	replys, err := models.GetAllReplys(tId, true)
	if err != nil {
		beego.Error(err)
		this.Redirect("/", 302)
		return
	}
	this.Data["Replys"] = replys
}