loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add missing badges in user profile for /projects and /packages (#24232)

- Implement fix for user and organization page
- Add necessary ctx.Data

When switching tabs on `user profile page` the badges are shown for
`/gitea_user?tab=stars`, `/gitea_user?tab=activity` and missing under
`gitea_user/-/projects` and `gitea_user/-/packages`

This was added for users and organizations.

Before:

![image](https://user-images.githubusercontent.com/72307968/233338877-f795fae3-b65a-4ea1-8784-dd2b0cd6618f.png)
After:

![image](https://user-images.githubusercontent.com/72307968/233339012-90adb6c4-4de2-432e-ae49-69611eb7aec3.png)

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>

authored by

Jakob
silverwind
Giteabot
and committed by
GitHub
136d7492 30ea09c2

+8 -3
+1
routers/web/org/members.go
··· 62 62 } 63 63 ctx.Data["Page"] = pager 64 64 ctx.Data["Members"] = members 65 + ctx.Data["ContextUser"] = ctx.ContextUser 65 66 ctx.Data["MembersIsPublicMember"] = membersIsPublic 66 67 ctx.Data["MembersIsUserOrgOwner"] = organization.IsUserOrgOwner(members, org.ID) 67 68 ctx.Data["MembersTwoFaStatus"] = members.GetTwoFaStatus()
+1
routers/web/org/teams.go
··· 56 56 } 57 57 } 58 58 ctx.Data["Teams"] = ctx.Org.Teams 59 + ctx.Data["ContextUser"] = ctx.ContextUser 59 60 60 61 ctx.HTML(http.StatusOK, tplTeams) 61 62 }
+6 -3
templates/user/overview/header.tmpl
··· 20 20 <div class="ui secondary stackable pointing menu"> 21 21 <a class="item" href="{{.ContextUser.HomeLink}}"> 22 22 {{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}} 23 + {{if .ContextUser.NumRepos}} 24 + <div class="ui small label">{{.ContextUser.NumRepos}}</div> 25 + {{end}} 23 26 </a> 24 27 {{if and .IsProjectEnabled (or .ContextUser.IsIndividual (and .ContextUser.IsOrganization .CanReadProjects))}} 25 28 <a href="{{.ContextUser.HomeLink}}/-/projects" class="{{if .PageIsViewProjects}}active {{end}}item"> ··· 42 45 <a class="item" href="{{$.OrgLink}}/members"> 43 46 {{svg "octicon-person"}}&nbsp;{{$.locale.Tr "org.members"}} 44 47 {{if .NumMembers}} 45 - <div class="ui primary label">{{.NumMembers}}</div> 48 + <div class="ui small label">{{.NumMembers}}</div> 46 49 {{end}} 47 50 </a> 48 51 <a class="item" href="{{$.OrgLink}}/teams"> 49 52 {{svg "octicon-people"}}&nbsp;{{$.locale.Tr "org.teams"}} 50 53 {{if .NumTeams}} 51 - <div class="ui primary label">{{.NumTeams}}</div> 54 + <div class="ui small label">{{.NumTeams}}</div> 52 55 {{end}} 53 56 </a> 54 57 {{end}} ··· 68 71 <a class='{{if eq .TabName "stars"}}active {{end}}item' href="{{.ContextUser.HomeLink}}?tab=stars"> 69 72 {{svg "octicon-star"}} {{.locale.Tr "user.starred"}} 70 73 {{if .ContextUser.NumStars}} 71 - <div class="ui primary label">{{.ContextUser.NumStars}}</div> 74 + <div class="ui small label">{{.ContextUser.NumStars}}</div> 72 75 {{end}} 73 76 </a> 74 77 {{else}}