Don't show "0" labels on repo tabs (#13289)

If count is zero, don't show the label, matching GH behavior.
This commit is contained in:
silverwind 2020-10-24 13:54:33 +02:00 committed by GitHub
parent 0800c7e91d
commit a69e11209d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 6 deletions

View File

@ -83,7 +83,10 @@
{{if .Permission.CanRead $.UnitTypeIssues}} {{if .Permission.CanRead $.UnitTypeIssues}}
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues"> <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
{{svg "octicon-issue-opened"}} {{.i18n.Tr "repo.issues"}} <span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{CountFmt .Repository.NumOpenIssues}}</span> {{svg "octicon-issue-opened"}} {{.i18n.Tr "repo.issues"}}
{{if .Repository.NumOpenIssues}}
<span class="ui blue small label">{{CountFmt .Repository.NumOpenIssues}}</span>
{{end}}
</a> </a>
{{end}} {{end}}
@ -95,22 +98,28 @@
{{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}} {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}}
<a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls"> <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
{{svg "octicon-git-pull-request"}} {{.i18n.Tr "repo.pulls"}} <span class="ui {{if not .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{CountFmt .Repository.NumOpenPulls}}</span> {{svg "octicon-git-pull-request"}} {{.i18n.Tr "repo.pulls"}}
{{if .Repository.NumOpenPulls}}
<span class="ui blue small label">{{CountFmt .Repository.NumOpenPulls}}</span>
{{end}}
</a> </a>
{{end}} {{end}}
{{ if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}} {{ if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}}
<a href="{{.RepoLink}}/projects" class="{{ if .IsProjectsPage }}active{{end}} item"> <a href="{{.RepoLink}}/projects" class="{{ if .IsProjectsPage }}active{{end}} item">
{{svg "octicon-project"}} {{.i18n.Tr "repo.project_board"}} {{svg "octicon-project"}} {{.i18n.Tr "repo.project_board"}}
<span class="ui {{if not .Repository.NumOpenProjects}}gray{{else}}blue{{end}} small label"> {{if .Repository.NumOpenProjects}}
{{CountFmt .Repository.NumOpenProjects}} <span class="ui blue small label">{{CountFmt .Repository.NumOpenProjects}}</span>
</span> {{end}}
</a> </a>
{{ end }} {{ end }}
{{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo) }} {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo) }}
<a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases"> <a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
{{svg "octicon-tag"}} {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .NumReleases}}gray{{else}}blue{{end}} small label">{{CountFmt .NumReleases}}</span> {{svg "octicon-tag"}} {{.i18n.Tr "repo.releases"}}
{{if .NumReleases}}
<span class="ui blue small label">{{CountFmt .NumReleases}}</span>
{{end}}
</a> </a>
{{end}} {{end}}