aboutsummaryrefslogtreecommitdiffstats
path: root/modules/templates
diff options
context:
space:
mode:
authorPedro Alves <pta2002@users.noreply.github.com>2020-10-25 21:49:48 +0000
committerGitHub <noreply@github.com>2020-10-25 17:49:48 -0400
commitc40df54e28fe1a1cfd0fc5f834451996d96028f3 (patch)
treec4337b06fe24f70b385dd6b7e1198f2d4c26de9b /modules/templates
parent756c090dbef0f4a1caffe8292780eea6c1d24c77 (diff)
downloadgitea-c40df54e28fe1a1cfd0fc5f834451996d96028f3.tar.gz
gitea-c40df54e28fe1a1cfd0fc5f834451996d96028f3.zip
Group Label Changed Comments in timeline (#13304)
* Create function to group label comments * Combine multiple label additions into one * Group removed and added labels in the same comment * Fix indentation on comments.tmpl Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'modules/templates')
-rw-r--r--modules/templates/helper.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 63be27d987..03ec80f99c 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -343,6 +343,16 @@ func NewFuncMap() []template.FuncMap {
// the table is NOT sorted with this header
return ""
},
+ "RenderLabels": func(labels []*models.Label) template.HTML {
+ html := ""
+
+ for _, label := range labels {
+ html = fmt.Sprintf("%s<div class='ui label' style='color: %s; background-color: %s'>%s</div>",
+ html, label.ForegroundColor(), label.Color, RenderEmoji(label.Name))
+ }
+
+ return template.HTML(html)
+ },
}}
}