1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-17 15:44:25 +00:00

Add repository counter badge to repository tab (#24205)

Add a new badge to the repository tab for users and organizations.
The badge is only visible if a repo exists.

Change the badge color of existing "Starred Repositories". (from primary to small)

Closes #24188
This commit is contained in:
Jakob 2023-04-19 20:58:36 +02:00 committed by GitHub
parent eed6b28fc0
commit 52b17bfa07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -2,6 +2,9 @@
<div class="ui secondary stackable pointing menu"> <div class="ui secondary stackable pointing menu">
<a class="{{if .PageIsViewRepositories}}active {{end}}item" href="{{$.Org.HomeLink}}"> <a class="{{if .PageIsViewRepositories}}active {{end}}item" href="{{$.Org.HomeLink}}">
{{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}} {{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}}
{{if .Owner.NumRepos}}
<div class="ui small label">{{.Owner.NumRepos}}</div>
{{end}}
</a> </a>
{{if and .IsProjectEnabled .CanReadProjects}} {{if and .IsProjectEnabled .CanReadProjects}}
<a class="{{if .PageIsViewProjects}}active {{end}}item" href="{{$.Org.HomeLink}}/-/projects"> <a class="{{if .PageIsViewProjects}}active {{end}}item" href="{{$.Org.HomeLink}}/-/projects">
@ -22,13 +25,13 @@
<a class="{{if $.PageIsOrgMembers}}active {{end}}item" href="{{$.OrgLink}}/members"> <a class="{{if $.PageIsOrgMembers}}active {{end}}item" href="{{$.OrgLink}}/members">
{{svg "octicon-person"}}&nbsp;{{$.locale.Tr "org.members"}} {{svg "octicon-person"}}&nbsp;{{$.locale.Tr "org.members"}}
{{if .NumMembers}} {{if .NumMembers}}
<div class="ui primary label">{{.NumMembers}}</div> <div class="ui small label">{{.NumMembers}}</div>
{{end}} {{end}}
</a> </a>
<a class="{{if $.PageIsOrgTeams}}active {{end}}item" href="{{$.OrgLink}}/teams"> <a class="{{if $.PageIsOrgTeams}}active {{end}}item" href="{{$.OrgLink}}/teams">
{{svg "octicon-people"}}&nbsp;{{$.locale.Tr "org.teams"}} {{svg "octicon-people"}}&nbsp;{{$.locale.Tr "org.teams"}}
{{if .NumTeams}} {{if .NumTeams}}
<div class="ui primary label">{{.NumTeams}}</div> <div class="ui small label">{{.NumTeams}}</div>
{{end}} {{end}}
</a> </a>
{{end}} {{end}}

View File

@ -123,6 +123,9 @@
<div class="ui secondary stackable pointing tight menu"> <div class="ui secondary stackable pointing tight menu">
<a class='{{if and (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars") (ne .TabName "watching") (ne .TabName "projects") (ne .TabName "code")}}active {{end}}item' href="{{.Owner.HomeLink}}"> <a class='{{if and (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars") (ne .TabName "watching") (ne .TabName "projects") (ne .TabName "code")}}active {{end}}item' href="{{.Owner.HomeLink}}">
{{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}} {{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}}
{{if .Owner.NumRepos}}
<div class="ui small label">{{.Owner.NumRepos}}</div>
{{end}}
</a> </a>
<a href="{{.Owner.HomeLink}}/-/projects" class="{{if eq .TabName "projects"}}active {{end}}item"> <a href="{{.Owner.HomeLink}}/-/projects" class="{{if eq .TabName "projects"}}active {{end}}item">
{{svg "octicon-project-symlink"}} {{.locale.Tr "user.projects"}} {{svg "octicon-project-symlink"}} {{.locale.Tr "user.projects"}}
@ -144,7 +147,7 @@
<a class='{{if eq .TabName "stars"}}active {{end}}item' href="{{.Owner.HomeLink}}?tab=stars"> <a class='{{if eq .TabName "stars"}}active {{end}}item' href="{{.Owner.HomeLink}}?tab=stars">
{{svg "octicon-star"}} {{.locale.Tr "user.starred"}} {{svg "octicon-star"}} {{.locale.Tr "user.starred"}}
{{if .Owner.NumStars}} {{if .Owner.NumStars}}
<div class="ui primary label">{{.Owner.NumStars}}</div> <div class="ui small label">{{.Owner.NumStars}}</div>
{{end}} {{end}}
</a> </a>
{{else}} {{else}}