Skip to content

Commit

Permalink
Add missing badges in user profile for /projects and /packages
Browse files Browse the repository at this point in the history
- Implement fix for users and organizations
- Add necessary ctx.Data
  • Loading branch information
jakob30061 committed Apr 21, 2023
1 parent 948a9ee commit f0a0f3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions routers/web/org/members.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func Members(ctx *context.Context) {
}
ctx.Data["Page"] = pager
ctx.Data["Members"] = members
ctx.Data["ContextUser"] = ctx.ContextUser
ctx.Data["MembersIsPublicMember"] = membersIsPublic
ctx.Data["MembersIsUserOrgOwner"] = organization.IsUserOrgOwner(members, org.ID)
ctx.Data["MembersTwoFaStatus"] = members.GetTwoFaStatus()
Expand Down
1 change: 1 addition & 0 deletions routers/web/org/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func Teams(ctx *context.Context) {
}
}
ctx.Data["Teams"] = ctx.Org.Teams
ctx.Data["ContextUser"] = ctx.ContextUser

ctx.HTML(http.StatusOK, tplTeams)
}
Expand Down
9 changes: 6 additions & 3 deletions templates/user/overview/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<div class="ui secondary stackable pointing menu">
<a class="item" href="{{.ContextUser.HomeLink}}">
{{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}}
{{if .ContextUser.NumRepos}}
<div class="ui small label">{{.ContextUser.NumRepos}}</div>
{{end}}
</a>
{{if and .IsProjectEnabled (or .ContextUser.IsIndividual (and .ContextUser.IsOrganization .CanReadProjects))}}
<a href="{{.ContextUser.HomeLink}}/-/projects" class="{{if .PageIsViewProjects}}active {{end}}item">
Expand All @@ -42,13 +45,13 @@
<a class="item" href="{{$.OrgLink}}/members">
{{svg "octicon-person"}}&nbsp;{{$.locale.Tr "org.members"}}
{{if .NumMembers}}
<div class="ui primary label">{{.NumMembers}}</div>
<div class="ui small label">{{.NumMembers}}</div>
{{end}}
</a>
<a class="item" href="{{$.OrgLink}}/teams">
{{svg "octicon-people"}}&nbsp;{{$.locale.Tr "org.teams"}}
{{if .NumTeams}}
<div class="ui primary label">{{.NumTeams}}</div>
<div class="ui small label">{{.NumTeams}}</div>
{{end}}
</a>
{{end}}
Expand All @@ -68,7 +71,7 @@
<a class='{{if eq .TabName "stars"}}active {{end}}item' href="{{.ContextUser.HomeLink}}?tab=stars">
{{svg "octicon-star"}} {{.locale.Tr "user.starred"}}
{{if .ContextUser.NumStars}}
<div class="ui primary label">{{.ContextUser.NumStars}}</div>
<div class="ui small label">{{.ContextUser.NumStars}}</div>
{{end}}
</a>
{{else}}
Expand Down

0 comments on commit f0a0f3d

Please sign in to comment.