30 lines
709 B
Go
30 lines
709 B
Go
package forms
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/camzawacki/personal-site/ent/admin"
|
|
"github.com/camzawacki/personal-site/internal/routenames"
|
|
"github.com/camzawacki/personal-site/internal/ui"
|
|
. "github.com/camzawacki/personal-site/internal/ui/components"
|
|
. "maragu.dev/gomponents"
|
|
. "maragu.dev/gomponents/html"
|
|
)
|
|
|
|
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?", entityType.GetName()),
|
|
),
|
|
ControlGroup(
|
|
FormButton(ColorError, "Delete"),
|
|
ButtonLink(
|
|
ColorNone,
|
|
r.Path(routenames.AdminEntityList(entityType.GetName())),
|
|
"Cancel",
|
|
),
|
|
),
|
|
CSRF(r),
|
|
)
|
|
}
|