templating

package
v0.0.0-...-7f62c2e Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2013 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseContext

type BaseContext struct {
	TemplateName string
	Errors       []string
	Notices      []string
}

func NewBaseContext

func NewBaseContext(templateName string) *BaseContext

func (*BaseContext) AddError

func (ctx *BaseContext) AddError(err error)

func (*BaseContext) AddNotice

func (ctx *BaseContext) AddNotice(notice string)

func (*BaseContext) Name

func (ctx *BaseContext) Name() string

type FormContext

type FormContext struct {
	*BaseContext
	CsrfToken string
}

func NewFormContext

func NewFormContext(res http.ResponseWriter, req *http.Request, base *BaseContext) (*FormContext, error)

func (*FormContext) CsrfTokenField

func (fc *FormContext) CsrfTokenField() template.HTML

type TemplateContext

type TemplateContext interface {
	// Add an error that should be displayed
	// to the user
	AddError(err error)

	// Add a notice/message that should be
	// displayed to the user
	AddNotice(notice string)

	// Name of the (main) template that is being
	// rendered (not header or footer templates).
	Name() string
}

type TemplateRenderer

type TemplateRenderer interface {
	RenderTemplate(wr io.Writer, ctx TemplateContext) error
}

func NewTemplateRenderer

func NewTemplateRenderer() TemplateRenderer

Jump to

Keyboard shortcuts

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