parent
c88547ce71
commit
420851ca1f
5 changed files with 32 additions and 19 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
"code.gitea.io/gitea/models/organization"
|
"code.gitea.io/gitea/models/organization"
|
||||||
"code.gitea.io/gitea/models/perm"
|
"code.gitea.io/gitea/models/perm"
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
|
"code.gitea.io/gitea/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Organization contains organization context
|
// Organization contains organization context
|
||||||
|
@ -119,6 +120,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
|
||||||
}
|
}
|
||||||
ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
|
ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
|
||||||
ctx.Data["IsOrganizationMember"] = ctx.Org.IsMember
|
ctx.Data["IsOrganizationMember"] = ctx.Org.IsMember
|
||||||
|
ctx.Data["IsPackageEnabled"] = setting.Packages.Enabled
|
||||||
ctx.Data["IsPublicMember"] = func(uid int64) bool {
|
ctx.Data["IsPublicMember"] = func(uid int64) bool {
|
||||||
is, _ := organization.IsPublicMembership(ctx.Org.Organization.ID, uid)
|
is, _ := organization.IsPublicMembership(ctx.Org.Organization.ID, uid)
|
||||||
return is
|
return is
|
||||||
|
|
|
@ -280,6 +280,7 @@ func Profile(ctx *context.Context) {
|
||||||
pager.AddParam(ctx, "language", "Language")
|
pager.AddParam(ctx, "language", "Language")
|
||||||
}
|
}
|
||||||
ctx.Data["Page"] = pager
|
ctx.Data["Page"] = pager
|
||||||
|
ctx.Data["IsPackageEnabled"] = setting.Packages.Enabled
|
||||||
|
|
||||||
ctx.Data["ShowUserEmail"] = len(ctx.ContextUser.Email) > 0 && ctx.IsSigned && (!ctx.ContextUser.KeepEmailPrivate || ctx.ContextUser.ID == ctx.Doer.ID)
|
ctx.Data["ShowUserEmail"] = len(ctx.ContextUser.Email) > 0 && ctx.IsSigned && (!ctx.ContextUser.KeepEmailPrivate || ctx.ContextUser.ID == ctx.Doer.ID)
|
||||||
|
|
||||||
|
|
|
@ -473,10 +473,12 @@ func RegisterRoutes(m *web.Route) {
|
||||||
m.Post("/delete", admin.DeleteRepo)
|
m.Post("/delete", admin.DeleteRepo)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if setting.Packages.Enabled {
|
||||||
m.Group("/packages", func() {
|
m.Group("/packages", func() {
|
||||||
m.Get("", admin.Packages)
|
m.Get("", admin.Packages)
|
||||||
m.Post("/delete", admin.DeletePackageVersion)
|
m.Post("/delete", admin.DeletePackageVersion)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
m.Group("/hooks", func() {
|
m.Group("/hooks", func() {
|
||||||
m.Get("", admin.DefaultOrSystemWebhooks)
|
m.Get("", admin.DefaultOrSystemWebhooks)
|
||||||
|
@ -670,6 +672,7 @@ func RegisterRoutes(m *web.Route) {
|
||||||
}, reqSignIn)
|
}, reqSignIn)
|
||||||
|
|
||||||
m.Group("/{username}/-", func() {
|
m.Group("/{username}/-", func() {
|
||||||
|
if setting.Packages.Enabled {
|
||||||
m.Group("/packages", func() {
|
m.Group("/packages", func() {
|
||||||
m.Get("", user.ListPackages)
|
m.Get("", user.ListPackages)
|
||||||
m.Group("/{type}/{name}", func() {
|
m.Group("/{type}/{name}", func() {
|
||||||
|
@ -685,6 +688,7 @@ func RegisterRoutes(m *web.Route) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}, context.PackageAssignment(), reqPackageAccess(perm.AccessModeRead))
|
}, context.PackageAssignment(), reqPackageAccess(perm.AccessModeRead))
|
||||||
|
}
|
||||||
}, context_service.UserAssignmentWeb())
|
}, context_service.UserAssignmentWeb())
|
||||||
|
|
||||||
// ***** Release Attachment Download without Signin
|
// ***** Release Attachment Download without Signin
|
||||||
|
@ -973,7 +977,9 @@ func RegisterRoutes(m *web.Route) {
|
||||||
m.Get("/milestones", reqRepoIssuesOrPullsReader, repo.Milestones)
|
m.Get("/milestones", reqRepoIssuesOrPullsReader, repo.Milestones)
|
||||||
}, context.RepoRef())
|
}, context.RepoRef())
|
||||||
|
|
||||||
|
if setting.Packages.Enabled {
|
||||||
m.Get("/packages", repo.Packages)
|
m.Get("/packages", repo.Packages)
|
||||||
|
}
|
||||||
|
|
||||||
m.Group("/projects", func() {
|
m.Group("/projects", func() {
|
||||||
m.Get("", repo.Projects)
|
m.Get("", repo.Projects)
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
<a class="{{if .PageIsViewRepositories}}active{{end}} item" href="{{$.Org.HomeLink}}">
|
<a class="{{if .PageIsViewRepositories}}active{{end}} item" href="{{$.Org.HomeLink}}">
|
||||||
{{svg "octicon-repo"}} {{.i18n.Tr "user.repositories"}}
|
{{svg "octicon-repo"}} {{.i18n.Tr "user.repositories"}}
|
||||||
</a>
|
</a>
|
||||||
|
{{if .IsPackageEnabled}}
|
||||||
<a class="item" href="{{$.Org.HomeLink}}/-/packages">
|
<a class="item" href="{{$.Org.HomeLink}}/-/packages">
|
||||||
{{svg "octicon-package"}} {{.i18n.Tr "packages.title"}}
|
{{svg "octicon-package"}} {{.i18n.Tr "packages.title"}}
|
||||||
</a>
|
</a>
|
||||||
|
{{end}}
|
||||||
{{if .IsOrganizationMember}}
|
{{if .IsOrganizationMember}}
|
||||||
<a class="{{if $.PageIsOrgMembers}}active{{end}} item" href="{{$.OrgLink}}/members">
|
<a class="{{if $.PageIsOrgMembers}}active{{end}} item" href="{{$.OrgLink}}/members">
|
||||||
{{svg "octicon-organization"}} {{$.i18n.Tr "org.people"}}
|
{{svg "octicon-organization"}} {{$.i18n.Tr "org.people"}}
|
||||||
|
|
|
@ -87,9 +87,11 @@
|
||||||
<a class='{{if and (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars") (ne .TabName "watching") (ne .TabName "projects")}}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")}}active{{end}} item' href="{{.Owner.HomeLink}}">
|
||||||
{{svg "octicon-repo"}} {{.i18n.Tr "user.repositories"}}
|
{{svg "octicon-repo"}} {{.i18n.Tr "user.repositories"}}
|
||||||
</a>
|
</a>
|
||||||
|
{{if .IsPackageEnabled}}
|
||||||
<a class='{{if eq .TabName "packages"}}active{{end}} item' href="{{.Owner.HomeLink}}/-/packages">
|
<a class='{{if eq .TabName "packages"}}active{{end}} item' href="{{.Owner.HomeLink}}/-/packages">
|
||||||
{{svg "octicon-package"}} {{.i18n.Tr "packages.title"}}
|
{{svg "octicon-package"}} {{.i18n.Tr "packages.title"}}
|
||||||
</a>
|
</a>
|
||||||
|
{{end}}
|
||||||
<a class='{{if eq .TabName "activity"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity">
|
<a class='{{if eq .TabName "activity"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity">
|
||||||
{{svg "octicon-rss"}} {{.i18n.Tr "user.activity"}}
|
{{svg "octicon-rss"}} {{.i18n.Tr "user.activity"}}
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue