htmgo/templates/starter/__htmgo/partials-generated.go

26 lines
700 B
Go
Raw Normal View History

2024-09-23 15:57:59 +00:00
// Package __htmgo THIS FILE IS GENERATED. DO NOT EDIT.
package __htmgo
2024-09-11 00:52:18 +00:00
2024-09-14 00:05:55 +00:00
import "github.com/maddalax/htmgo/framework/h"
2024-09-17 17:13:22 +00:00
import "github.com/labstack/echo/v4"
2024-09-13 21:33:50 +00:00
import "starter-template/partials"
2024-09-11 00:52:18 +00:00
2024-09-17 17:13:22 +00:00
func GetPartialFromContext(ctx echo.Context) *h.Partial {
path := ctx.Request().URL.Path
2024-09-23 15:57:59 +00:00
if path == "CounterPartial" || path == "/starter-template/partials.CounterPartial" {
cc := ctx.(*h.RequestContext)
2024-09-23 15:57:59 +00:00
return partials.CounterPartial(cc)
}
2024-09-11 00:52:18 +00:00
return nil
}
2024-09-13 18:29:02 +00:00
2024-09-17 17:13:22 +00:00
func RegisterPartials(f *echo.Echo) {
f.Any("starter-template/partials*", func(ctx echo.Context) error {
2024-09-13 18:29:02 +00:00
partial := GetPartialFromContext(ctx)
if partial == nil {
2024-09-17 17:13:22 +00:00
return ctx.NoContent(404)
2024-09-13 18:29:02 +00:00
}
return h.PartialView(ctx, partial)
})
}