diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-06-12 14:08:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-12 20:08:23 +0800 |
commit | 796c4eca0bacf67c186768de66fcfee21867045f (patch) | |
tree | 3fc7947372c955953c0c6d443b05d3585a6ce300 /modules/util/util.go | |
parent | 0097fbc2ac153a686b68af43e791704e9b5cf74b (diff) | |
download | gitea-796c4eca0bacf67c186768de66fcfee21867045f.tar.gz gitea-796c4eca0bacf67c186768de66fcfee21867045f.zip |
Prettify number of issues (#17760)
* Prettify number of issues
- Use the PrettyNumber function to add commas in large amount of issues.
* Use client-side formatting
* prettify on both server and client
* remove unused i18n entries
* handle more cases, support other int types in PrettyNumber
* specify locale to avoid issues with node default locale
* remove superfluos argument
* introduce template helper, octicon tweaks, js refactor
* Update modules/templates/helper.go
* Apply some suggestions.
* Add comment
* Update templates/user/dashboard/issues.tmpl
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules/util/util.go')
-rw-r--r-- | modules/util/util.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/util/util.go b/modules/util/util.go index 1017117874..be60fe4b4b 100644 --- a/modules/util/util.go +++ b/modules/util/util.go @@ -224,3 +224,21 @@ func Dedent(s string) string { } return strings.TrimSpace(s) } + +// NumberIntoInt64 transform a given int into int64. +func NumberIntoInt64(number interface{}) int64 { + var value int64 + switch v := number.(type) { + case int: + value = int64(v) + case int8: + value = int64(v) + case int16: + value = int64(v) + case int32: + value = int64(v) + case int64: + value = v + } + return value +} |