This commit is contained in:
wxiaoguang 2024-12-22 21:06:21 +08:00
parent 35c86af164
commit c0168bfa06
3 changed files with 13 additions and 6 deletions

View File

@ -111,7 +111,7 @@ func home(ctx *context.Context, viewRepositories bool) {
ctx.Data["DisableNewPullMirrors"] = setting.Mirror.DisableNewPull
ctx.Data["ShowMemberAndTeamTab"] = ctx.Org.IsMember || len(members) > 0
if !prepareOrgProfileReadme(ctx, viewRepositories) {
if !prepareOrgProfileRepo(ctx, viewRepositories) {
ctx.Data["PageIsViewRepositories"] = true
}
@ -168,15 +168,18 @@ func home(ctx *context.Context, viewRepositories bool) {
ctx.HTML(http.StatusOK, tplOrgHome)
}
func prepareOrgProfileReadme(ctx *context.Context, viewRepositories bool) bool {
func prepareOrgProfileRepo(ctx *context.Context, viewRepositories bool) bool {
profileDbRepo, profileGitRepo, profileReadme, profileClose := shared_user.FindUserProfileReadme(ctx, ctx.Doer)
defer profileClose()
ctx.Data["HasProfileReadme"] = profileReadme != nil
if profileGitRepo == nil || profileReadme == nil || viewRepositories {
return false
}
ctx.Data["OrgProfileRepo"] = profileDbRepo
ctx.Data["HasProfileWiki"] = profileDbRepo.HasWiki()
ctx.Data["HasProfileReadme"] = true
if bytes, err := profileReadme.GetBlobContent(setting.UI.MaxDisplayFileSize); err != nil {
log.Error("failed to GetBlobContent: %v", err)
} else {

View File

@ -16,13 +16,12 @@
{{if .ShowMemberAndTeamTab}}
<div class="ui five wide column">
{{if .CanCreateOrgRepo}}
<div class="center aligned tw-mb-4">
<div class="flex-text-block tw-flex-wrap tw-justify-end tw-mb-4">
<a class="ui primary button" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}">{{ctx.Locale.Tr "new_repo"}}</a>
{{if not .DisableNewPullMirrors}}
<a class="ui primary button" href="{{AppSubUrl}}/repo/migrate?org={{.Org.ID}}&mirror=1">{{ctx.Locale.Tr "new_migrate"}}</a>
{{end}}
</div>
<div class="divider"></div>
{{end}}
{{if .NumMembers}}
<h4 class="ui top attached header tw-flex">
@ -33,7 +32,7 @@
{{$isMember := .IsOrganizationMember}}
{{range .Members}}
{{if or $isMember (call $.IsPublicMember .ID)}}
<a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}">{{ctx.AvatarUtils.Avatar . 48}}</a>
<a href="{{.HomeLink}}" data-tooltip-content="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}">{{ctx.AvatarUtils.Avatar . 24}}</a>
{{end}}
{{end}}
</div>

View File

@ -20,6 +20,11 @@
{{end}}
</a>
{{end}}
{{if .HasProfileWiki}}
<a class="item" href="{{$.OrgProfileRepo.Link}}/wiki">
{{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}}
</a>
{{end}}
{{if and .IsPackageEnabled .CanReadPackages}}
<a class="{{if .IsPackagesPage}}active {{end}}item" href="{{$.Org.HomeLink}}/-/packages">
{{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}}