nidus-sync/htmlpage/public-reports/page.go
Eli Ribble bacd452346 Split up html page logic into site-specific packages
This is a significant overhaul to make it possible to serve totally
different templates with different components for the different sites.
2026-01-07 18:36:20 +00:00

31 lines
726 B
Go

package publicreports
import (
"embed"
"fmt"
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
)
//go:embed template/*
var embeddedFiles embed.FS
type RootContext struct{}
var (
Root = buildTemplate("root", "base")
)
var components = [...]string{}
func buildTemplate(files ...string) *htmlpage.BuiltTemplate {
subdir := "htmlpage/public-reports"
full_files := make([]string, 0)
for _, f := range files {
full_files = append(full_files, fmt.Sprintf("%s/template/%s.html", subdir, f))
}
for _, c := range components {
full_files = append(full_files, fmt.Sprintf("%s/template/components/%s.html", subdir, c))
}
return htmlpage.NewBuiltTemplate(embeddedFiles, "htmlpage/public-reports/", full_files...)
}