Documentation
¶
Overview ¶
Package templates centralizes access to template functions that render the power-league content as HTML.
Index ¶
Constants ¶
const ( // DefaultBaseDir is the default location of the directory containing the // template files. DefaultBaseDir = "html/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AboutPageContent ¶
type AboutPageContent struct { LoggedIn bool SiteConfig *SiteConfig }
AboutPageContent describes the power rankings web site.
type AllYearlyLeagues ¶
type AllYearlyLeagues []*YearlyLeagues
AllYearlyLeagues contains leagues for multiple years.
func (AllYearlyLeagues) Len ¶
func (y AllYearlyLeagues) Len() int
func (AllYearlyLeagues) Less ¶
func (y AllYearlyLeagues) Less(i, j int) bool
func (AllYearlyLeagues) Swap ¶
func (y AllYearlyLeagues) Swap(i, j int)
type ErrorPageContent ¶ added in v0.2.0
type ErrorPageContent struct { Message string LoggedIn bool SiteConfig *SiteConfig }
ErrorPageContent describes an error that has occurred in the application.
type LeaguesPageContent ¶
type LeaguesPageContent struct { AllYears AllYearlyLeagues LoggedIn bool SiteConfig *SiteConfig }
LeaguesPageContent describes the leagues a user has participated in across multiple years.
type PreviousRank ¶ added in v0.3.0
PreviousRank defines the rank a team had for a previous week and the offset between that rank and the current rank.
type RankingsPageContent ¶
type RankingsPageContent struct { Weeks int League *goff.League LeagueStarted bool SchemeToShow rankings.Scheme Schemes []rankings.Scheme LeaguePowerData []*rankings.LeaguePowerData LoggedIn bool SiteConfig *SiteConfig }
RankingsPageContent is used to show an given league's power rankings up to a certain week in the season.
type SiteConfig ¶
type SiteConfig struct { TLS bool BaseContext string StaticContext string AnalyticsTrackingID string }
SiteConfig provides configuration info about the site that can be used on all pages.
type Templates ¶
type Templates interface { WriteAboutTemplate(w io.Writer, content *AboutPageContent) error WriteErrorTemplate(w io.Writer, content *ErrorPageContent) error WriteLeaguesTemplate(w io.Writer, content *LeaguesPageContent) error WriteRankingsTemplate(w io.Writer, content *RankingsPageContent) error }
Templates provides programmtic access to power rankings templates
func NewTemplates ¶
func NewTemplates() Templates
NewTemplates creates new templates using the `DefaultBaseDir`
func NewTemplatesFromDir ¶
NewTemplatesFromDir creates new templates using the given directory as the base
type YearlyLeagues ¶
YearlyLeagues describes the leagues for a user for a given year.