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 /templates/repo | |
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 'templates/repo')
-rw-r--r-- | templates/repo/issue/milestones.tmpl | 12 | ||||
-rw-r--r-- | templates/repo/issue/openclose.tmpl | 12 | ||||
-rw-r--r-- | templates/repo/projects/list.tmpl | 14 |
3 files changed, 23 insertions, 15 deletions
diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl index b6b1c76d78..235044cb17 100644 --- a/templates/repo/issue/milestones.tmpl +++ b/templates/repo/issue/milestones.tmpl @@ -18,11 +18,11 @@ <div class="ui compact tiny menu"> <a class="item{{if not .IsShowClosed}} active{{end}}" href="{{.RepoLink}}/milestones?state=open&q={{$.Keyword}}"> {{svg "octicon-milestone" 16 "mr-3"}} - {{.i18n.Tr "repo.milestones.open_tab" .OpenCount}} + {{JsPrettyNumber .OpenCount}} {{.i18n.Tr "repo.issues.open_title"}} </a> <a class="item{{if .IsShowClosed}} active{{end}}" href="{{.RepoLink}}/milestones?state=closed&q={{$.Keyword}}"> - {{svg "octicon-milestone" 16 "mr-3"}} - {{.i18n.Tr "repo.milestones.close_tab" .ClosedCount}} + {{svg "octicon-check" 16 "mr-3"}} + {{JsPrettyNumber .ClosedCount}} {{.i18n.Tr "repo.issues.closed_title"}} </a> </div> </div> @@ -83,8 +83,10 @@ {{end}} {{end}} <span class="issue-stats"> - {{svg "octicon-issue-opened"}} {{$.i18n.Tr "repo.issues.open_tab" .NumOpenIssues}} - {{svg "octicon-issue-closed"}} {{$.i18n.Tr "repo.issues.close_tab" .NumClosedIssues}} + {{svg "octicon-issue-opened" 16 "mr-3"}} + {{JsPrettyNumber .NumOpenIssues}} {{$.i18n.Tr "repo.issues.open_title"}} + {{svg "octicon-check" 16 "mr-3"}} + {{JsPrettyNumber .NumClosedIssues}} {{$.i18n.Tr "repo.issues.closed_title"}} {{if .TotalTrackedTime}}{{svg "octicon-clock"}} {{.TotalTrackedTime|Sec2Time}}{{end}} {{if .UpdatedUnix}}{{svg "octicon-clock"}} {{$.i18n.Tr "repo.milestones.update_ago" (.TimeSinceUpdate|Sec2Time)}}{{end}} </span> diff --git a/templates/repo/issue/openclose.tmpl b/templates/repo/issue/openclose.tmpl index 050660522a..ae99f091b1 100644 --- a/templates/repo/issue/openclose.tmpl +++ b/templates/repo/issue/openclose.tmpl @@ -1,10 +1,14 @@ <div class="ui compact tiny menu"> <a class="{{if not .IsShowClosed}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state=open&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}"> - {{svg "octicon-issue-opened" 16 "mr-3"}} - {{.i18n.Tr "repo.issues.open_tab" .IssueStats.OpenCount}} + {{if .PageIsPullList}} + {{svg "octicon-git-pull-request" 16 "mr-3"}} + {{else}} + {{svg "octicon-issue-opened" 16 "mr-3"}} + {{end}} + {{JsPrettyNumber .IssueStats.OpenCount}} {{.i18n.Tr "repo.issues.open_title"}} </a> <a class="{{if .IsShowClosed}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{.ViewType}}&sort={{$.SortType}}&state=closed&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}"> - {{svg "octicon-issue-closed" 16 "mr-3"}} - {{.i18n.Tr "repo.issues.close_tab" .IssueStats.ClosedCount}} + {{svg "octicon-check" 16 "mr-3"}} + {{JsPrettyNumber .IssueStats.ClosedCount}} {{.i18n.Tr "repo.issues.closed_title"}} </a> </div> diff --git a/templates/repo/projects/list.tmpl b/templates/repo/projects/list.tmpl index a8c51d668e..7a2366da0b 100644 --- a/templates/repo/projects/list.tmpl +++ b/templates/repo/projects/list.tmpl @@ -14,12 +14,12 @@ {{template "base/alert" .}} <div class="ui compact tiny menu"> <a class="item{{if not .IsShowClosed}} active{{end}}" href="{{.RepoLink}}/projects?state=open"> - {{svg "octicon-project" 16 "mr-2"}} - {{.i18n.Tr "repo.issues.open_tab" .OpenCount}} + {{svg "octicon-project" 16 "mr-3"}} + {{JsPrettyNumber .OpenCount}} {{.i18n.Tr "repo.issues.open_title"}} </a> <a class="item{{if .IsShowClosed}} active{{end}}" href="{{.RepoLink}}/projects?state=closed"> - {{svg "octicon-check" 16 "mr-2"}} - {{.i18n.Tr "repo.milestones.close_tab" .ClosedCount}} + {{svg "octicon-check" 16 "mr-3"}} + {{JsPrettyNumber .ClosedCount}} {{.i18n.Tr "repo.issues.closed_title"}} </a> </div> @@ -47,8 +47,10 @@ {{svg "octicon-clock"}} {{$.i18n.Tr "repo.milestones.closed" $closedDate|Str2html}} {{end}} <span class="issue-stats"> - {{svg "octicon-issue-opened"}} {{$.i18n.Tr "repo.issues.open_tab" .NumOpenIssues}} - {{svg "octicon-issue-closed"}} {{$.i18n.Tr "repo.issues.close_tab" .NumClosedIssues}} + {{svg "octicon-issue-opened" 16 "mr-3"}} + {{JsPrettyNumber .NumOpenIssues}} {{$.i18n.Tr "repo.issues.open_title"}} + {{svg "octicon-check" 16 "mr-3"}} + {{JsPrettyNumber .NumClosedIssues}} {{$.i18n.Tr "repo.issues.closed_title"}} </span> </div> {{if and (or $.CanWriteIssues $.CanWritePulls) (not $.Repository.IsArchived)}} |