htmgo/templates/starter/__htmgo/partials-generated.go
2024-09-23 10:57:59 -05:00

25 lines
700 B
Go

// Package __htmgo THIS FILE IS GENERATED. DO NOT EDIT.
package __htmgo
import "github.com/maddalax/htmgo/framework/h"
import "github.com/labstack/echo/v4"
import "starter-template/partials"
func GetPartialFromContext(ctx echo.Context) *h.Partial {
path := ctx.Request().URL.Path
if path == "CounterPartial" || path == "/starter-template/partials.CounterPartial" {
cc := ctx.(*h.RequestContext)
return partials.CounterPartial(cc)
}
return nil
}
func RegisterPartials(f *echo.Echo) {
f.Any("starter-template/partials*", func(ctx echo.Context) error {
partial := GetPartialFromContext(ctx)
if partial == nil {
return ctx.NoContent(404)
}
return h.PartialView(ctx, partial)
})
}