From efcba9b011b328a425d8b2c8d9f2273bfbaa7340 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 16 Nov 2020 00:50:06 +0100 Subject: Render diff stats server-side (#13579) Eliminates a flash on page load on the diff stat bars. --- modules/templates/helper.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules/templates/helper.go') diff --git a/modules/templates/helper.go b/modules/templates/helper.go index e4107dfa9a..e1c5d5d86b 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -208,6 +208,9 @@ func NewFuncMap() []template.FuncMap { } return path }, + "DiffStatsWidth": func(adds int, dels int) string { + return fmt.Sprintf("%f", float64(adds)/(float64(adds)+float64(dels))*100) + }, "Json": func(in interface{}) string { out, err := json.Marshal(in) if err != nil { -- cgit v1.2.3