aboutsummaryrefslogtreecommitdiffstats
path: root/templates/org
diff options
context:
space:
mode:
authorChai-Shi <changchaishi@gmail.com>2024-12-31 12:22:09 +0800
committerGitHub <noreply@github.com>2024-12-31 04:22:09 +0000
commit0387195abb82080b4c488966960f25a3e8c6fe66 (patch)
tree794cf1e7705002236a33af563729284b48a303c5 /templates/org
parentc09656e0e0384b15405f909a0e7d7e94a373448e (diff)
downloadgitea-0387195abb82080b4c488966960f25a3e8c6fe66.tar.gz
gitea-0387195abb82080b4c488966960f25a3e8c6fe66.zip
[Feature] Private README.md for organization (#32872)
Implemented #29503 --------- Co-authored-by: Ben Chang <ben_chang@htc.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'templates/org')
-rw-r--r--templates/org/home.tmpl27
-rw-r--r--templates/org/menu.tmpl4
2 files changed, 27 insertions, 4 deletions
diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl
index 4851b69979..db750692bf 100644
--- a/templates/org/home.tmpl
+++ b/templates/org/home.tmpl
@@ -5,8 +5,8 @@
<div class="ui container">
<div class="ui mobile reversed stackable grid">
<div class="ui {{if .ShowMemberAndTeamTab}}eleven wide{{end}} column">
- {{if .ProfileReadme}}
- <div id="readme_profile" class="markup">{{.ProfileReadme}}</div>
+ {{if .ProfileReadmeContent}}
+ <div id="readme_profile" class="markup" data-profile-view-as-member="{{.IsViewingOrgAsMember}}">{{.ProfileReadmeContent}}</div>
{{end}}
{{template "shared/repo_search" .}}
{{template "explore/repo_list" .}}
@@ -24,6 +24,29 @@
</div>
<div class="divider"></div>
{{end}}
+
+ {{if and .ShowMemberAndTeamTab .ShowOrgProfileReadmeSelector}}
+ <div class="tw-my-4">
+ <div id="org-home-view-as-dropdown" class="ui dropdown jump">
+ {{- $viewAsRole := Iif (.IsViewingOrgAsMember) (ctx.Locale.Tr "org.members.member") (ctx.Locale.Tr "settings.visibility.public") -}}
+ <span class="text">{{svg "octicon-eye"}} {{ctx.Locale.Tr "org.view_as_role" $viewAsRole}}</span>
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ <div class="menu">
+ {{/* TODO: does it really need to use CurrentURL with query parameters? Why not construct a new link with clear parameters */}}
+ <a href="?view_as=public" class="item {{if not .IsViewingOrgAsMember}}selected{{end}}">
+ {{svg "octicon-check" 14 (Iif (not .IsViewingOrgAsMember) "" "tw-invisible")}} {{ctx.Locale.Tr "settings.visibility.public"}}
+ </a>
+ <a href="?view_as=member" class="item {{if .IsViewingOrgAsMember}}selected{{end}}">
+ {{svg "octicon-check" 14 (Iif .IsViewingOrgAsMember "" "tw-invisible")}} {{ctx.Locale.Tr "org.members.member"}}
+ </a>
+ </div>
+ </div>
+ <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>
+ </div>
+ {{end}}
+
{{if .NumMembers}}
<h4 class="ui top attached header tw-flex">
<strong class="tw-flex-1">{{ctx.Locale.Tr "org.members"}}</strong>
diff --git a/templates/org/menu.tmpl b/templates/org/menu.tmpl
index 29238f8d6b..4a8aee68a7 100644
--- a/templates/org/menu.tmpl
+++ b/templates/org/menu.tmpl
@@ -1,12 +1,12 @@
<div class="ui container">
<overflow-menu class="ui secondary pointing tabular borderless menu tw-mb-4">
<div class="overflow-menu-items">
- {{if .HasProfileReadme}}
+ {{if .HasOrgProfileReadme}}
<a class="{{if .PageIsViewOverview}}active {{end}}item" href="{{$.Org.HomeLink}}">
{{svg "octicon-info"}} {{ctx.Locale.Tr "user.overview"}}
</a>
{{end}}
- <a class="{{if .PageIsViewRepositories}}active {{end}}item" href="{{$.Org.HomeLink}}{{if .HasProfileReadme}}/-/repositories{{end}}">
+ <a class="{{if .PageIsViewRepositories}}active {{end}}item" href="{{$.Org.HomeLink}}{{if .HasOrgProfileReadme}}/-/repositories{{end}}">
{{svg "octicon-repo"}} {{ctx.Locale.Tr "user.repositories"}}
{{if .RepoCount}}
<div class="ui small label">{{.RepoCount}}</div>