fix template test renderer, add category

This commit is contained in:
41666 2025-04-06 22:27:42 -07:00
parent d9146750ba
commit e4317ec4fd
15 changed files with 171 additions and 103 deletions

View file

@ -2,14 +2,20 @@ package utils
import (
"fmt"
"git.sapphic.engineer/roleypoly/v4/types"
"html/template"
)
func RoleInputID(c *types.Category, r *types.Role) string {
return fmt.Sprintf("category-%s_role-%s", c.ID, r.ID)
func RoleInputID(c string, r string) string {
return fmt.Sprintf("category-%s_role-%s", c, r)
}
func RoleInputName(c *types.Category) string {
return fmt.Sprintf("category_group_%s", c.ID)
func RoleInputName(c string) string {
return fmt.Sprintf("category_group_%s", c)
}
func TemplateFuncs() template.FuncMap {
return template.FuncMap{
"roleInputID": RoleInputID,
"roleInputName": RoleInputName,
}
}