Skip to content

Commit a69e112

Browse files
authored
Don't show "0" labels on repo tabs (#13289)
If count is zero, don't show the label, matching GH behavior.
1 parent 0800c7e commit a69e112

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

templates/repo/header.tmpl

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@
8383

8484
{{if .Permission.CanRead $.UnitTypeIssues}}
8585
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
86-
{{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>
86+
{{svg "octicon-issue-opened"}} {{.i18n.Tr "repo.issues"}}
87+
{{if .Repository.NumOpenIssues}}
88+
<span class="ui blue small label">{{CountFmt .Repository.NumOpenIssues}}</span>
89+
{{end}}
8790
</a>
8891
{{end}}
8992

@@ -95,22 +98,28 @@
9598

9699
{{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}}
97100
<a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
98-
{{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>
101+
{{svg "octicon-git-pull-request"}} {{.i18n.Tr "repo.pulls"}}
102+
{{if .Repository.NumOpenPulls}}
103+
<span class="ui blue small label">{{CountFmt .Repository.NumOpenPulls}}</span>
104+
{{end}}
99105
</a>
100106
{{end}}
101107

102108
{{ if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}}
103109
<a href="{{.RepoLink}}/projects" class="{{ if .IsProjectsPage }}active{{end}} item">
104110
{{svg "octicon-project"}} {{.i18n.Tr "repo.project_board"}}
105-
<span class="ui {{if not .Repository.NumOpenProjects}}gray{{else}}blue{{end}} small label">
106-
{{CountFmt .Repository.NumOpenProjects}}
107-
</span>
111+
{{if .Repository.NumOpenProjects}}
112+
<span class="ui blue small label">{{CountFmt .Repository.NumOpenProjects}}</span>
113+
{{end}}
108114
</a>
109115
{{ end }}
110116

111117
{{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo) }}
112118
<a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
113-
{{svg "octicon-tag"}} {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .NumReleases}}gray{{else}}blue{{end}} small label">{{CountFmt .NumReleases}}</span>
119+
{{svg "octicon-tag"}} {{.i18n.Tr "repo.releases"}}
120+
{{if .NumReleases}}
121+
<span class="ui blue small label">{{CountFmt .NumReleases}}</span>
122+
{{end}}
114123
</a>
115124
{{end}}
116125

0 commit comments

Comments
 (0)