views

package
v0.0.0-...-85a449c Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2015 License: BSD-3-Clause Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const TemplateDirectories = "/templates"

Variables

This section is empty.

Functions

func GetTemplate

func GetTemplate(name string) string

func GetTemplateContents

func GetTemplateContents(templatepath string) string

func GetTemplatePath

func GetTemplatePath(templatename string) string

func TemplateRender

func TemplateRender(name string, c *Context)

func Upper

func Upper(s string) string

func UrlParamsToMap

func UrlParamsToMap(params httprouter.Params) map[string]interface{}

Types

type Context

type Context struct {
	Data   map[string]interface{}
	Form   url.Values
	Writer http.ResponseWriter
}

type Field

type Field struct {
	Required bool
	Type     string
}

type Form

type Form struct {
	Fields     map[string]Field // - name required
	SuccessUrl string
	Validate   func(values url.Values) []string
}

func (Form) HandleValidate

func (form Form) HandleValidate(values url.Values) []string

type View

type View struct {
	TemplateName string
	Form         Form
	Get          func(c *Context)
	Post         func(c *Context, e []string)
	GetContext   func(map[string]interface{}) map[string]interface{}
}

func (View) HandleGet

func (view View) HandleGet(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (View) HandlePost

func (view View) HandlePost(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

flow: check Post func then handleget if no post

Jump to

Keyboard shortcuts

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