From a69e11209d8f43f22ddac2dbfa6f1e7a87eba20f Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 24 Oct 2020 13:54:33 +0200 Subject: [PATCH] Don't show "0" labels on repo tabs (#13289) If count is zero, don't show the label, matching GH behavior. --- templates/repo/header.tmpl | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index ae32c3fed..77f2362f8 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -83,7 +83,10 @@ {{if .Permission.CanRead $.UnitTypeIssues}} - {{svg "octicon-issue-opened"}} {{.i18n.Tr "repo.issues"}} {{CountFmt .Repository.NumOpenIssues}} + {{svg "octicon-issue-opened"}} {{.i18n.Tr "repo.issues"}} + {{if .Repository.NumOpenIssues}} + {{CountFmt .Repository.NumOpenIssues}} + {{end}} {{end}} @@ -95,22 +98,28 @@ {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}} - {{svg "octicon-git-pull-request"}} {{.i18n.Tr "repo.pulls"}} {{CountFmt .Repository.NumOpenPulls}} + {{svg "octicon-git-pull-request"}} {{.i18n.Tr "repo.pulls"}} + {{if .Repository.NumOpenPulls}} + {{CountFmt .Repository.NumOpenPulls}} + {{end}} {{end}} {{ if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}} {{svg "octicon-project"}} {{.i18n.Tr "repo.project_board"}} - - {{CountFmt .Repository.NumOpenProjects}} - + {{if .Repository.NumOpenProjects}} + {{CountFmt .Repository.NumOpenProjects}} + {{end}} {{ end }} {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo) }} - {{svg "octicon-tag"}} {{.i18n.Tr "repo.releases"}} {{CountFmt .NumReleases}} + {{svg "octicon-tag"}} {{.i18n.Tr "repo.releases"}} + {{if .NumReleases}} + {{CountFmt .NumReleases}} + {{end}} {{end}}