github.com/segakazzz/buffalo@v0.16.22-0.20210119082501-1f52048d3feb/render/helpers.go (about) 1 package render 2 3 import ( 4 "html/template" 5 "net/http" 6 7 "github.com/gobuffalo/helpers/forms" 8 "github.com/gobuffalo/helpers/forms/bootstrap" 9 "github.com/gobuffalo/plush/v4" 10 "github.com/gobuffalo/tags/v3" 11 ) 12 13 func init() { 14 plush.Helpers.Add("paginator", func(pagination interface{}, 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 "", err 23 } 24 return t.HTML(), nil 25 }) 26 plush.Helpers.Add(forms.RemoteFormKey, bootstrap.RemoteForm) 27 plush.Helpers.Add(forms.RemoteFormForKey, bootstrap.RemoteFormFor) 28 }