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 3 commits 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
8 changes: 4 additions & 4 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1015,8 +1015,8 @@ new_repo_helper = A repository contains all project files, including revision hi
owner = Owner
owner_helper = Some organizations may not show up in the dropdown due to a maximum repository count limit.
repo_name = Repository Name
repo_name_profile_public_hint= .profile is a special repository that you can use to add README.md to your public organization profile, visible to anyone. Make sure it’s public and initialize it with a README in the profile directory to get started.
repo_name_profile_private_hint = .profile-private is a special repository that you can use to add a README.md to your organization member profile, visible only to organization members. Make sure it’s private and initialize it with a README in the profile directory to get started.
repo_name_profile_public_hint= .profile is a special repository that you can use to add README.md and Wiki to your public organization profile, visible to anyone. Make sure it’s public and initialize it with a README in the profile directory to get started.
repo_name_profile_private_hint = .profile-private is a special repository that you can use to add a README.md and Wiki to your organization member profile, visible only to organization members. Make sure it’s private and initialize it with a README in the profile directory to get started.
repo_name_helper = Good repository names use short, memorable and unique keywords. A repository named '.profile' or '.profile-private' could be used to add a README.md for the user/organization profile.
repo_size = Repository Size
template = Template
Expand Down Expand Up @@ -2865,8 +2865,8 @@ teams.invite.by = Invited by %s
teams.invite.description = Please click the button below to join the team.

view_as_role = View as: %s
view_as_public_hint = You are viewing the README a public user.
view_as_member_hint = You are viewing the README a member of this organization.
view_as_public_hint = You are viewing the README/Wiki as a public user.
view_as_member_hint = You are viewing the README/Wiki as a member of this organization.

[admin]
maintenance = Maintenance
Expand Down
3 changes: 3 additions & 0 deletions routers/web/org/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ func prepareOrgProfileReadme(ctx *context.Context, prepareResult *shared_user.Pr
return false
}

ctx.Data["HasOrgProfileWiki"] = profileRepo.HasWiki()
ctx.Data["OrgProfileRepo"] = profileRepo

readmeBytes, err := readmeBlob.GetBlobContent(setting.UI.MaxDisplayFileSize)
if err != nil {
log.Error("failed to GetBlobContent for profile %q (view as %q) readme: %v", profileRepo.FullName(), viewAs, err)
Expand Down
6 changes: 6 additions & 0 deletions templates/org/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
<div class="tw-my-2">
{{if .IsViewingOrgAsMember}}{{ctx.Locale.Tr "org.view_as_member_hint"}}{{else}}{{ctx.Locale.Tr "org.view_as_public_hint"}}{{end}}
</div>
{{if .HasOrgProfileWiki}}
{{/* FIXME: the "view as" affects the "wiki link", it can't be in the menu tab. Need to figure out some better UI/UX solutions. */}}
<a class="tw-my-2" href="{{$.OrgProfileRepo.Link}}/wiki">
{{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}}
</a>
{{end}}
</div>
{{end}}

Expand Down
Loading