views

package
v0.0.0-...-f7ca523 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2017 License: MIT Imports: 18 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func ErrorFlash

func ErrorFlash(w http.ResponseWriter, r *http.Request, message string)

func GetTemplate

func GetTemplate(templateName string) (*template.Template, error)

func InfoFlash

func InfoFlash(w http.ResponseWriter, r *http.Request, message string)

func LoadTemplates

func LoadTemplates()

func SuccessFlash

func SuccessFlash(w http.ResponseWriter, r *http.Request, message string)

Types

type Flash

type Flash struct {
	Message string
	Class   string
}

type Paginator

type Paginator struct {
	Page        int
	PerPage     int
	Offset      int
	Limit       int
	NumPages    int
	Start       int
	End         int
	HasPrev     bool
	HasNext     bool
	BaseURL     *url.URL
	PrevPageURL string
	NextPageURL string
}

func NewPaginator

func NewPaginator(page, perPage int, url *url.URL) (*Paginator, error)
func (p *Paginator) PageLink(page int) string

func (*Paginator) Render

func (p *Paginator) Render(totalItems int) string

type View

type View struct {
	Vars    map[string]interface{}
	Request *http.Request
}

func New

func New(req *http.Request) *View

func (*View) IsCurrentURL

func (v *View) IsCurrentURL(url string) bool

func (*View) Render

func (v *View) Render(w http.ResponseWriter, name string)

func (*View) RenderError

func (v *View) RenderError(w http.ResponseWriter, status int)

Jump to

Keyboard shortcuts

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