view

package
v0.0.0-...-a63f1f6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FlashError   = "alert-danger"
	FlashSuccess = "alert-success"
	FlashNotice  = "alert-info"
	FlashWarning = "alert-warning"
)

Functions

func Configure

func Configure(vi View)

Configure will set the view information

func FileTime

func FileTime(name string) (string, error)

FileTime returns the modification time of the file

func LoadPlugins

func LoadPlugins(fms ...template.FuncMap)

LoadPlugins will combine all template.FuncMaps into one map and then set the plugins for the templates If a func already exists, it is rewritten, there is no error

func LoadTemplates

func LoadTemplates(rootTemp string, childTemps []string)

LoadTemplates will set the root and child templates

func Repopulate

func Repopulate(list []string, src url.Values, dst map[string]interface{})

Repopulate updates the dst map so the form fields can be refilled

func Validate

func Validate(req *http.Request, required []string) (bool, string)

Validate returns true if all the required form values are passed

Types

type Flash

type Flash struct {
	Message string
	Class   string
}

Flash Message

type Template

type Template struct {
	Root     string   `json:"Root"`
	Children []string `json:"Children"`
}

Template root and children

type View

type View struct {
	BaseURI   string
	Extension string
	Folder    string
	Name      string
	Caching   bool
	Vars      map[string]interface{}
	// contains filtered or unexported fields
}

View attributes

func New

func New(req *http.Request) *View

New returns a new view

func ReadConfig

func ReadConfig() View

Read the configuration

func (*View) AssetTimePath

func (v *View) AssetTimePath(s string) (string, error)

AssetTimePath returns a URL with the proper base uri and timestamp appended. Works for CSS and JS assets Determines if local or on the web

func (*View) PrependBaseURI

func (v *View) PrependBaseURI(s string) string

PrependBaseURI prepends the base URI to the string

func (*View) Render

func (v *View) Render(w http.ResponseWriter)

Render a template to the screen

func (*View) RenderSingle

func (v *View) RenderSingle(w http.ResponseWriter)

Render a template to the screen

func (*View) SendFlashes

func (v *View) SendFlashes(w http.ResponseWriter)

SendFlashes allows retrieval of flash messages for using with Ajax

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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