func (this *AdminController) Collection() { fmt.Println("Collection") checkLogin(this) this.TplNames = "admin/collection.tpl" id := this.Ctx.Input.Param(":id") collection, err := models.CollectionById(id) if err != nil { panic(err) } this.Data["CollectionActive"] = true this.Data["Collection"] = collection this.Data["PostId"] = "update/" + id renderTemplate(this.Ctx, "views/admin/collection.amber", this.Data) }
func (this *FrontController) Collection() { dir := "" dirId := "" // Configure direction if this.GetString("prev") != "" { dir = "prev" dirId = this.GetString("prev") } if this.GetString("next") != "" { dir = "next" dirId = this.GetString("next") } cid := this.Ctx.Input.Param(":id") collection, err := models.CollectionById(cid) if err != nil { panic(err) } entries, havePrev, haveNext, err := models.EntriesByCollection(cid, dir, dirId) if err != nil { panic(err) } this.TplNames = "entry-list.tpl" this.Data["Title"] = collection.Title this.Data["Subtitle"] = collection.Subtitle this.Data["Entries"] = entries this.Data["Pos"] = this.UrlFor("FrontController.Collection", ":id", cid) if len(entries) != 0 { this.Data["FirstId"] = entries[0].Id this.Data["LastId"] = entries[len(entries)-1].Id } // Pagination this.Data["PageNav"] = "true" this.Data["HavePrev"] = havePrev this.Data["HaveNext"] = haveNext renderTemplate(this.Ctx, "views/entry-list.amber", this.Data) }