Skip to content

Commit f9fdd01

Browse files
committed
fix
1 parent ad03c6e commit f9fdd01

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

modules/templates/util_string.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ func (su *StringUtils) HasPrefix(s, prefix string) bool {
1818
func (su *StringUtils) Contains(s, substr string) bool {
1919
return strings.Contains(s, substr)
2020
}
21+
22+
func (su *StringUtils) Split(s, sep string) []string {
23+
return strings.Split(s, sep)
24+
}

templates/repo/sub_menu.tmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
</div>
1616
{{end}}
1717
<div class="item">
18-
<span>{{svg "octicon-database"}} <b>{{FileSize .Repository.Size}}</b></span>
18+
{{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}}
19+
{{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}}
20+
<span>{{svg "octicon-database"}} <b>{{index $fileSizeFields 0}}</b> {{index $fileSizeFields 1}}</span>
1921
</div>
2022
{{end}}
2123
</div>

0 commit comments

Comments
 (0)