summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-11-16 00:50:06 +0100
committerGitHub <noreply@github.com>2020-11-15 23:50:06 +0000
commitefcba9b011b328a425d8b2c8d9f2273bfbaa7340 (patch)
tree92f7812aa0f184b6b76b957eee56d19b14f31ef6 /modules
parent0de546009e466486cd88dfa98d07d8775bd3087d (diff)
downloadgitea-efcba9b011b328a425d8b2c8d9f2273bfbaa7340.tar.gz
gitea-efcba9b011b328a425d8b2c8d9f2273bfbaa7340.zip
Render diff stats server-side (#13579)
Eliminates a flash on page load on the diff stat bars.
Diffstat (limited to 'modules')
-rw-r--r--modules/templates/helper.go3
1 files changed, 3 insertions, 0 deletions
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 {