Generate ent schema in admin code. (#127)

This commit is contained in:
Mike Stefanello 2025-08-04 08:32:10 -04:00 committed by GitHub
parent 67a97832a5
commit 9e6d9fd063
13 changed files with 303 additions and 142 deletions

View file

@ -3,6 +3,7 @@ package forms
import (
"net/http"
"github.com/mikestefanello/pagoda/ent/admin"
"github.com/mikestefanello/pagoda/pkg/routenames"
"github.com/mikestefanello/pagoda/pkg/ui"
. "github.com/mikestefanello/pagoda/pkg/ui/components"
@ -10,17 +11,17 @@ import (
. "maragu.dev/gomponents/html"
)
func AdminEntityDelete(r *ui.Request, entityTypeName string) Node {
func AdminEntityDelete(r *ui.Request, entityType admin.EntityType) Node {
return Form(
Method(http.MethodPost),
P(
Textf("Are you sure you want to delete this %s?", entityTypeName),
Textf("Are you sure you want to delete this %s?", entityType.GetName()),
),
ControlGroup(
FormButton(ColorError, "Delete"),
ButtonLink(
ColorNone,
r.Path(routenames.AdminEntityList(entityTypeName)),
r.Path(routenames.AdminEntityList(entityType.GetName())),
"Cancel",
),
),