panel: place drill-down back links under the heading
test / test (push) Has been cancelled

The user form had Back to users at the bottom of the card; all drill-down
pages now use a shared back_link template with a structural test.

Co-Authored-By: Claude <Composer 2.5> <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-11 21:58:08 +03:00
parent f1074eb526
commit 5bd632c8e0
8 changed files with 58 additions and 5 deletions
+12 -1
View File
@@ -65,7 +65,7 @@ func New(version string) (*Engine, error) {
}
for name, files := range pageFiles {
patterns := append([]string{"templates/layout.html"}, files...)
tmpl, err := template.New("layout.html").ParseFS(assetsFS, patterns...)
tmpl, err := template.New("layout.html").Funcs(templateFuncs()).ParseFS(assetsFS, patterns...)
if err != nil {
return nil, fmt.Errorf("parse template %s: %w", name, err)
}
@@ -81,6 +81,17 @@ func New(version string) (*Engine, error) {
return e, nil
}
// templateFuncs supplies helpers shared across page templates.
func templateFuncs() template.FuncMap {
return template.FuncMap{
// back builds the map back_link reads; keeps href and label paired at
// the call site instead of repeating the <a class="back"> markup.
"back": func(href, label string) map[string]string {
return map[string]string{"Href": href, "Label": label}
},
}
}
// Page returns a parsed page template by logical name. It is exported for
// template guard tests that assert structural properties across all pages.
func (e *Engine) Page(name string) *template.Template {