add group breadcrumbs to repo page header

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧
2026-04-02 20:44:12 -04:00
parent a1abb071f4
commit 92cb2a7080
2 changed files with 16 additions and 1 deletions
+10
View File
@@ -5,6 +5,7 @@
package context
import (
group_model "code.gitea.io/gitea/models/group"
"context"
"errors"
"fmt"
@@ -609,6 +610,15 @@ func RepoAssignment(ctx *Context) {
ctx.Data["Title"] = repo.Owner.Name + "/" + repo.Name
ctx.Data["PageTitleCommon"] = repo.Name + " - " + setting.AppName
ctx.Data["Repository"] = repo
if repo.GroupID > 0 {
if ctx.Data["Breadcrumbs"], err = group_model.GetParentGroupChain(ctx, repo.GroupID); err != nil {
ctx.ServerError("GetParentGroupChain", err)
return
}
} else {
ctx.Data["Breadcrumbs"] = nil
}
ctx.Data["Owner"] = ctx.Repo.Repository.Owner
ctx.Data["CanWriteCode"] = ctx.Repo.CanWrite(unit_model.TypeCode)
ctx.Data["CanWriteIssues"] = ctx.Repo.CanWrite(unit_model.TypeIssues)
+6 -1
View File
@@ -8,7 +8,12 @@
</div>
<div class="flex-item-main">
<div class="flex-item-title tw-text-18">
<a class="muted tw-font-normal" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/<a class="muted" href="{{$.RepoLink}}">{{.Name}}</a>
<a class="muted tw-font-normal" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>
{{- range $.Breadcrumbs -}}
/<a class="muted{{if eq .ID $.Group.ID}} tw-font-bold active{{else}} tw-font-normal{{end}}"
href="{{.GroupLink}}">{{.Name}}</a>
{{- end -}}
/<a class="muted" href="{{$.RepoLink}}">{{.Name}}</a>
</div>
</div>
<div class="flex-item-trailing">