views

package
v0.0.0-...-a41d4d2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2017 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AlertLvlError   = "danger"
	AlertLvlWarning = "warning"
	AlertLvlInfo    = "info"
	AlertLvlSuccess = "success"

	// AlertMsgGeneric is displayed when any random error
	// is encountered by our backend.
	AlertMsgGeneric = "Something went wrong. Please try again, and contact us if the problem persists."
)

Variables

View Source
var (
	LayoutDir   string = "views/layouts/"
	TemplateDir string = "views/"
	TemplateExt string = ".gohtml"
)

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Level   string
	Message string
}

Alert is used to render Bootstrap Alert messages in templates

type Data

type Data struct {
	Alert *Alert
	User  *models.User
	CSRF  template.HTML
	Yield interface{}
}

Data is the top level structure that views expect data to come in.

func (*Data) AlertError

func (d *Data) AlertError(msg string)

func (*Data) SetAlert

func (d *Data) SetAlert(err error)

type PublicError

type PublicError interface {
	error
	Public() string
}

type View

type View struct {
	Template *template.Template
	Layout   string
}

func NewView

func NewView(layout string, files ...string) *View

func (*View) Render

func (v *View) Render(w http.ResponseWriter, r *http.Request, data interface{})

Render is used to render the view with the predefined layout.

func (*View) ServeHTTP

func (v *View) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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