func (this *PostRouter) New() { this.TplName = "post/new.html" if this.CheckActiveRedirect() { return } form := post.PostForm{Locale: this.Locale} if v := this.Ctx.GetCookie("post_topic"); len(v) > 0 { form.Topic, _ = utils.StrTo(v).Int() } if v := this.Ctx.GetCookie("post_cat"); len(v) > 0 { form.Category, _ = utils.StrTo(v).Int() } if v := this.Ctx.GetCookie("post_lang"); len(v) > 0 { form.Lang, _ = utils.StrTo(v).Int() } else { form.Lang = this.Locale.Index() } slug := this.GetString("topic") if len(slug) > 0 { topic := models.Topic{Slug: slug} topic.Read("Slug") form.Topic = topic.Id this.Data["Topic"] = &topic } post.ListCategories(&form.Categories) post.ListTopics(&form.Topics) this.SetFormSets(&form) }