func (c StemcellsController) Index(req *http.Request, r martrend.Render, params mart.Params) {
	filter := bhstemui.StemcellFilter{
		Name: params["_1"],
		IncludeDeprecatedDistros: true,
	}

	stemcells, err := c.stemcellsRepo.FindAll(filter.Name)
	if err != nil {
		r.HTML(500, c.errorTmpl, err)
		return
	}

	// Show either groups of stemcells by OS or for a specific stemcell name
	distroGroups := bhstemui.NewDistroGroups(stemcells, filter)

	r.HTML(200, c.indexTmpl, stemcellsControllerIndexPage{distroGroups, filter})
}
Ejemplo n.º 2
0
func (c HomeController) Home(r martrend.Render) {
	relVerRecs, err := c.releasesRepo.ListCurated()
	if err != nil {
		r.HTML(500, c.errorTmpl, err)
		return
	}

	stemcells, err := c.stemcellsRepo.FindAll("")
	if err != nil {
		r.HTML(500, c.errorTmpl, err)
		return
	}

	page := homeControllerPage{
		UniqueSourceReleases: bhrelui.NewUniqueSourceReleases(relVerRecs),

		// Show either groups of stemcells by OS
		StemcellDistroGroups: bhstemui.NewDistroGroups(stemcells, bhstemui.StemcellFilter{}),
	}

	r.HTML(200, c.homeTmpl, page)
}