mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-08 06:53:35 +02:00
add group breadcrumbs to repo page header
This commit is contained in:
parent
a1abb071f4
commit
92cb2a7080
@ -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)
|
||||
|
||||
@ -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">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user