Documentation ¶
Index ¶
- Constants
- type NavPrinter
- type SessionData
- type TypeSessID
- type WebApp
- func (wa *WebApp) ColorBackground() string
- func (wa *WebApp) ColorCodeBlockBackground() string
- func (wa *WebApp) ColorCodeBlockText() string
- func (wa *WebApp) ColorCodeHover() string
- func (wa *WebApp) ColorControls() string
- func (wa *WebApp) ColorHeader() string
- func (wa *WebApp) ColorHelpBackground() string
- func (wa *WebApp) ColorHover() string
- func (wa *WebApp) ColorNavBackground() string
- func (wa *WebApp) ColorNavSelected() string
- func (wa *WebApp) ColorNavText() string
- func (wa *WebApp) ColorTitle() string
- func (wa *WebApp) CoursePaths() [][]int
- func (wa *WebApp) DataSourceLink() template.URL
- func (wa *WebApp) DataSourceName() string
- func (wa *WebApp) DocTitle() string
- func (wa *WebApp) Host() string
- func (wa *WebApp) InitialBlock() int
- func (wa *WebApp) InitialHeaderOn() bool
- func (wa *WebApp) InitialLesson() int
- func (wa *WebApp) InitialNavOn() bool
- func (wa *WebApp) KeyBlockIndex() string
- func (wa *WebApp) KeyIsHeaderOn() string
- func (wa *WebApp) KeyIsNavOn() string
- func (wa *WebApp) KeyLessonIndex() string
- func (wa *WebApp) KeySessID() string
- func (wa *WebApp) LayBodyMediumWidth() int
- func (wa *WebApp) LayBodyWideWidth() int
- func (wa *WebApp) LayFooterHeight() int
- func (wa *WebApp) LayHeaderHeight() int
- func (wa *WebApp) LayMinHeaderWidth() int
- func (wa *WebApp) LayMinimizedHeaderHeight() int
- func (wa *WebApp) LayNavBoxWidth() int
- func (wa *WebApp) LayNavLeftPad() int
- func (wa *WebApp) LayNavTopBotPad() int
- func (wa *WebApp) LessonCount() int
- func (wa *WebApp) Lessons() []*program.LessonPgm
- func (wa *WebApp) Render(w io.Writer) error
- func (wa *WebApp) SessID() TypeSessID
- func (wa *WebApp) TransitionSpeedMs() int
Constants ¶
const ( // KeySessID is the param name for session ID. KeySessID = "sid" // KeyIsHeaderOn is the param name for is the header on boolean. KeyIsHeaderOn = "hed" KeyIsNavOn = "nav" // KeyLessonIndex is the param name for the lesson index. KeyLessonIndex = "lix" // KeyBlockIndex is the param name for the block index. KeyBlockIndex = "bix" )
These must all be unique, and preferably short. They are used as URL query param and cookie field names.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NavPrinter ¶
type NavPrinter struct { // contains filtered or unexported fields }
NavPrinter prints leftnav HTML to a Writer.
func NewTutorialNavPrinter ¶
func NewTutorialNavPrinter(w io.Writer) *NavPrinter
NewTutorialNavPrinter returns a new printer for the given writer.
func (*NavPrinter) VisitBlockTut ¶
func (v *NavPrinter) VisitBlockTut(x *model.BlockTut)
VisitBlockTut does nothing. Not expanding blocks in the nav - too busy looking.
func (*NavPrinter) VisitCourse ¶
func (v *NavPrinter) VisitCourse(x *model.Course)
VisitCourse visits a course to print it.
func (*NavPrinter) VisitLessonTut ¶
func (v *NavPrinter) VisitLessonTut(x *model.LessonTut)
VisitLessonTut visits a lesson to print it.
func (*NavPrinter) VisitTopCourse ¶
func (v *NavPrinter) VisitTopCourse(x *model.TopCourse)
VisitTopCourse visits a course to print its children.
type SessionData ¶
type SessionData struct { // The session ID. SessID TypeSessID // Is the header showing? IsHeaderOn bool IsNavOn bool // The active lesson. LessonIndex int // The active block. BlockIndex int }
SessionData holds session state data, presumably associated with a cookie.
func AssureSessionData ¶
func AssureSessionData(s *sessions.Session) *SessionData
AssureSessionData tries to recover session data, saving defaults for missing data.
type WebApp ¶
type WebApp struct {
// contains filtered or unexported fields
}
WebApp presents a tutorial to a web browser.
func NewWebApp ¶
func NewWebApp( sessionData *SessionData, host string, tut model.Tutorial, ds *base.DataSource, lp []int, cp [][]int) *WebApp
NewWebApp makes a new web app.
func (*WebApp) ColorBackground ¶
ColorBackground is just that.
func (*WebApp) ColorCodeBlockBackground ¶
ColorCodeBlockBackground is just that.
func (*WebApp) ColorCodeBlockText ¶
ColorCodeBlockText is just that.
func (*WebApp) ColorCodeHover ¶
ColorCodeHover is just that.
func (*WebApp) ColorHelpBackground ¶
ColorHelpBackground is just that.
func (*WebApp) ColorNavBackground ¶
ColorNavBackground is just that.
func (*WebApp) ColorNavSelected ¶
ColorNavSelected is just that.
func (*WebApp) CoursePaths ¶
CoursePaths emits a javascript 2D array holding lesson paths. The length equals the number of lessons. Each entry should contain an array of course indices that should be active when the lesson is active.
func (*WebApp) DataSourceLink ¶
DataSourceLink lets the user find the original data.
func (*WebApp) DataSourceName ¶
DataSourceName is the source of the data.
func (*WebApp) InitialBlock ¶
InitialBlock is where the user should start.
func (*WebApp) InitialHeaderOn ¶
InitialHeaderOn is should the header be on?
func (*WebApp) InitialLesson ¶
InitialLesson is where the user should start.
func (*WebApp) InitialNavOn ¶
InitialNavOn is should the nav be on?
func (*WebApp) KeyBlockIndex ¶
KeyBlockIndex delivers the corresponding const to a template.
func (*WebApp) KeyIsHeaderOn ¶
KeyIsHeaderOn delivers the corresponding const to a template.
func (*WebApp) KeyIsNavOn ¶
KeyIsNavOn delivers the corresponding const to a template.
func (*WebApp) KeyLessonIndex ¶
KeyLessonIndex delivers the corresponding const to a template.
func (*WebApp) LayBodyMediumWidth ¶
LayBodyMediumWidth is the min body width of medium mode. Small mode (presumably phones) is anything thinner.
func (*WebApp) LayBodyWideWidth ¶
LayBodyWideWidth is the min body width of "wide" mode.
func (*WebApp) LayFooterHeight ¶
LayFooterHeight is just that.
func (*WebApp) LayHeaderHeight ¶
LayHeaderHeight is just that.
func (*WebApp) LayMinHeaderWidth ¶
LayMinHeaderWidth is just that.
func (*WebApp) LayMinimizedHeaderHeight ¶
LayMinimizedHeaderHeight is just that.
func (*WebApp) LayNavTopBotPad ¶
LayNavTopBotPad is just that.
func (*WebApp) SessID ¶
func (wa *WebApp) SessID() TypeSessID
SessID is the id of the session returned
func (*WebApp) TransitionSpeedMs ¶
TransitionSpeedMs is speed of css transitions in milliseconds.