view

package
v0.0.0-...-cea30b5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2016 License: AGPL-3.0 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 Repopuldate

func Repopuldate(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)

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"`
}

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

func ReadConfig

func ReadConfig() View

Read the configuration

func (*View) AssertTimePath

func (v *View) AssertTimePath(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

func (*View) Render

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

Render a template

func (*View) RenderSingle

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

Render a template

func (*View) SendFlashes

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

SendFlashes allows retrieval of the flash messages va Ajax

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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