Example #1
0
func AllFeed(c *middleware.Context) {
	p := c.ParamsInt(":p")
	if p < 1 {
		p = 1
	}
	feed, e := models.GetFeed(p)
	if e != nil {
		color.Red("%s", e)
	}

	cnt, e := models.FeedCount()
	if e != nil {
		color.Red("%s", e)
	}

	c.Data["feed"] = feed
	c.Data["paginater"] = paginater.New(int(cnt), 10, p, 5)
	c.HTML(200, "catalog/feed")
}
Example #2
0
func Index(c *middleware.Context) {
	var (
		p = c.ParamsInt(":p")
	)
	sites, e := models.SiteList(p)
	if e != nil {
		color.Red("%s", e)
	}

	cnt, e := models.SiteCount()
	if e != nil {
		color.Red("%s", e)
	}

	c.Data["sites"] = sites
	c.Data["sites_count"] = cnt
	c.Data["paginater"] = paginater.New(int(cnt), 10, p, 5)
	c.HTML(200, "catalog/index")
}
Example #3
0
func Feed(c *middleware.Context) {
	sid := c.ParamsInt64(":id")
	p := c.ParamsInt(":p")
	if p < 1 {
		p = 1
	}
	feed, e := models.GetSiteFeed(sid, p)
	if e != nil {
		color.Red("%s", e)
	}

	cnt, e := models.SiteFeedCount(sid)
	if e != nil {
		color.Red("%s", e)
	}

	c.Data["feed"] = feed
	c.Data["paginater"] = paginater.New(int(cnt), 10, p, 5)
	c.Data["SiteId"] = sid
	c.HTML(200, "catalog/feed")
}