docs: add missing template registration step to plan

- Add tmplPreferences variable to views.go var block
- Initialize tmplPreferences in init() function
- Add RenderPreferences function to views.go
- Fix step numbering for Task 4

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ashisgreat22 2026-03-22 13:26:22 +01:00
parent ce92a692f8
commit d071921329

View file

@ -982,10 +982,35 @@ Append to `kafka.css`:
}
```
- [ ] **Step 3: Commit**
- [ ] **Step 3: Register preferences template in views.go**
Add `tmplPreferences` variable and initialize it in `init()`. Also add `RenderPreferences` function:
```go
// In views.go, add to var block:
var (
tmplFull *template.Template
tmplIndex *template.Template
tmplFragment *template.Template
tmplPreferences *template.Template
)
// In init(), after existing template parsing, add:
tmplPreferences = template.Must(template.New("").Funcs(funcMap).ParseFS(tmplFS,
"base.html", "preferences.html",
))
// Add RenderPreferences function:
func RenderPreferences(w http.ResponseWriter, sourceURL string) error {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
return tmplPreferences.ExecuteTemplate(w, "base", PageData{ShowHeader: true, SourceURL: sourceURL})
}
```
- [ ] **Step 4: Commit**
```bash
git add internal/views/templates/preferences.html internal/views/static/css/kafka.css
git add internal/views/templates/preferences.html internal/views/static/css/kafka.css internal/views/views.go
git commit -m "feat(frontend): add preferences page template and styles"
```