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

28 lines
764 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-13 18:29:02 +00:00
import "github.com/gofiber/fiber/v2"
2024-09-13 21:33:50 +00:00
import "starter-template/partials"
2024-09-11 00:52:18 +00:00
func GetPartialFromContext(ctx *fiber.Ctx) *h.Partial {
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
}
return nil
}
2024-09-13 18:29:02 +00:00
func RegisterPartials(f *fiber.App) {
2024-09-13 21:33:50 +00:00
f.All("starter-template/partials*", func(ctx *fiber.Ctx) error {
2024-09-13 18:29:02 +00:00
partial := GetPartialFromContext(ctx)
if partial == nil {
return ctx.SendStatus(404)
}
return h.PartialView(ctx, partial)
})
}