htmgo/starter-template/partials/load/generated.go

31 lines
885 B
Go
Raw Normal View History

2024-09-11 00:52:18 +00:00
// Package partials THIS FILE IS GENERATED. DO NOT EDIT.
package load
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 {
2024-09-11 00:52:18 +00:00
path := ctx.Path()
if path == "SamplePartial" || path == "/starter-template/partials.SamplePartial" {
return partials.SamplePartial(ctx)
2024-09-11 00:52:18 +00:00
}
if path == "NewPartial" || path == "/starter-template/partials.NewPartial" {
return partials.NewPartial(ctx)
2024-09-11 00:52:18 +00:00
}
if path == "NewPartial2" || path == "/starter-template/partials.NewPartial2" {
return partials.NewPartial2(ctx)
}
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)
})
}