tmpl

package
v0.0.0-...-389ba5e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dashboard

type Dashboard struct {
	Playlists []PlaylistInfo
	Env       string
}

Dashboard is the data required to template `/dashboard`

type Help

type Help struct {
	Env string
}

Help is the data required to template '/help'

type Home

type Home struct {
	SpotifyAuthURL string
	Env            string
}

Home is the data required to template '/' and `/login`

type Mobile

type Mobile struct {
	Env string
}

Mobile is the data required to template '/mobile'

type Playlist

type Playlist struct {
	IsNew bool

	Name           string
	NameErr        string
	Description    string
	DescriptionErr string
	Schedule       store.Schedule
	Public         bool

	Sources          []TrackSource
	SourcesErr       string
	PotentialSources []PotentialSource

	Env string
}

Playlist is the data required to template '/playlist/{playlistID}'

type PlaylistInfo

type PlaylistInfo struct {
	store.Playlist
	TotalSongs       int
	BuildTagSrc      string
	ScheduleBlurb    string
	ScheduleSentence string
	ImageURL         string
	FailureBlurb     string
}

PlaylistInfo is a playlist wrapped with extra metadata

type PotentialSource

type PotentialSource struct {
	Name     string
	ID       string
	Type     store.TrackSourceType
	ImageURL string
}

PotentialSource is the data for a playlists potential source of tracks

type TemplateService

type TemplateService struct {
	// contains filtered or unexported fields
}

TemplateService is the concrete implmentation of Templater backed by html/template

func New

func New(log *zap.SugaredLogger, env string) (*TemplateService, error)

New returns a pointer to a TemplateService

func (*TemplateService) TmplDashboard

func (t *TemplateService) TmplDashboard(w http.ResponseWriter, data Dashboard)

TmplDashboard templates '/'

func (*TemplateService) TmplHelp

func (t *TemplateService) TmplHelp(w http.ResponseWriter)

TmplHelp templates `/help`

func (*TemplateService) TmplHome

func (t *TemplateService) TmplHome(w http.ResponseWriter, data Home)

TmplHome templates '/'

func (*TemplateService) TmplMobile

func (t *TemplateService) TmplMobile(w http.ResponseWriter)

TmplMobile templates `/mobile`

func (*TemplateService) TmplPlaylist

func (t *TemplateService) TmplPlaylist(w http.ResponseWriter, data Playlist)

TmplPlaylist templates '/playlist/{playlistID}'

func (*TemplateService) TmplTrackSource

func (t *TemplateService) TmplTrackSource(w http.ResponseWriter, data TrackSource)

TmplTrackSource templates '/playlist/{playlistID}/source/type/{type}/name/{name}/id/{id}'

type Templater

type Templater interface {
	TmplHome(w http.ResponseWriter, data Home)
	TmplDashboard(w http.ResponseWriter, data Dashboard)
	TmplPlaylist(w http.ResponseWriter, data Playlist)
	TmplTrackSource(w http.ResponseWriter, data TrackSource)
	TmplMobile(w http.ResponseWriter)
	TmplHelp(w http.ResponseWriter)
}

Templater provides methods for templating HTML web pages

type TrackSource

type TrackSource struct {
	store.TrackSource
	CountString string
	CountErr    string
}

TrackSource is the data required to template '/playlist/{playlistID}/source/type/{type}/name/{name}/id/{id}'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL