feat(audit): clickable column headers with asc/desc sort

This commit is contained in:
2026-05-05 08:15:22 +01:00
parent deb8b874ca
commit 4f66cc2b34
7 changed files with 207 additions and 8 deletions
+25
View File
@@ -43,6 +43,31 @@ func funcMap() template.FuncMap {
return base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%v", x)))
}
},
// sortDir computes the dir param for a sort-header link:
// click the active column → toggle asc/desc; click any other
// column → start at desc (newest-first / Z→A) since that's
// the conventional default for date and frequency-style data.
"sortDir": func(thisCol, currentCol, currentDir string) string {
if thisCol != currentCol {
return "desc"
}
if currentDir == "asc" {
return "desc"
}
return "asc"
},
// sortGlyph returns the unicode arrow glyph for the sort
// header — empty string for inactive columns so they don't
// shout.
"sortGlyph": func(thisCol, currentCol, currentDir string) string {
if thisCol != currentCol {
return ""
}
if currentDir == "asc" {
return "↑"
}
return "↓"
},
"derefInt": func(p *int) int {
if p == nil {
return 0