From 3cfff5af0d3cf544540efe42e6e6d2564140c0c9 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Fri, 10 Jan 2025 04:29:37 +0800 Subject: [PATCH] Move repo size to sidebar (#33155) (#33182) Backport #33155 by @yp05327 ![image](https://github.com/user-attachments/assets/8b14dbb7-ec36-4596-a6aa-72c14d93309d) Co-authored-by: yp05327 <576951401@qq.com> --- templates/repo/home_sidebar_top.tmpl | 5 +++++ templates/repo/sub_menu.tmpl | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/repo/home_sidebar_top.tmpl b/templates/repo/home_sidebar_top.tmpl index 607dc62e2e..d7c2b8336f 100644 --- a/templates/repo/home_sidebar_top.tmpl +++ b/templates/repo/home_sidebar_top.tmpl @@ -62,6 +62,11 @@ {{svg "octicon-cross-reference"}} {{ctx.Locale.Tr "repo.cite_this_repo"}} {{end}} + + {{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}} + {{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}} + {{svg "octicon-database"}} {{ctx.Locale.PrettyNumber (index $fileSizeFields 0)}} {{index $fileSizeFields 1}} + diff --git a/templates/repo/sub_menu.tmpl b/templates/repo/sub_menu.tmpl index ccb98b94ad..1e83b53ef0 100644 --- a/templates/repo/sub_menu.tmpl +++ b/templates/repo/sub_menu.tmpl @@ -13,11 +13,6 @@ {{svg "octicon-tag"}} {{ctx.Locale.PrettyNumber .NumTags}} {{ctx.Locale.TrN .NumTags "repo.tag" "repo.tags"}} {{end}} - - {{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}} - {{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}} - {{svg "octicon-database"}} {{ctx.Locale.PrettyNumber (index $fileSizeFields 0)}} {{index $fileSizeFields 1}} - {{end}}