Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add profile wiki to org home #32947

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions routers/web/org/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions templates/org/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>
Expand Down
5 changes: 5 additions & 0 deletions templates/org/menu.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}
Expand Down
Loading