github.com/res-am/buffalo@v0.11.1/render/helpers.go (about) 1 package render 2 3 import ( 4 "html/template" 5 "net/http" 6 7 "github.com/gobuffalo/plush" 8 "github.com/gobuffalo/pop" 9 "github.com/gobuffalo/tags" 10 "github.com/pkg/errors" 11 ) 12 13 func init() { 14 plush.Helpers.Add("paginator", func(pagination *pop.Paginator, opts map[string]interface{}, help plush.HelperContext) (template.HTML, error) { 15 if opts["path"] == nil { 16 if req, ok := help.Value("request").(*http.Request); ok { 17 opts["path"] = req.URL.String() 18 } 19 } 20 t, err := tags.Pagination(pagination, opts) 21 if err != nil { 22 return "", errors.WithStack(err) 23 } 24 return t.HTML(), nil 25 }) 26 }