Add descriptions for private repo public access settings and improve the UI (#34057)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
pull/34054/head^2
yp05327 2025-03-29 22:24:27 +09:00 committed by GitHub
parent cddd19efc8
commit 5023238088
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 55 additions and 32 deletions

View File

@ -2138,6 +2138,11 @@ settings = Settings
settings.desc = Settings is where you can manage the settings for the repository
settings.options = Repository
settings.public_access = Public Access
settings.public_access_desc = Configure public visitor's access permissions to override the defaults of this repository.
settings.public_access.docs.not_set = Not Set: no extra public access permission. The visitor's permission follows the repository's visibility and member permissions.
settings.public_access.docs.anonymous_read = Anonymous Read: users who are not logged in can access the unit with read permission.
settings.public_access.docs.everyone_read = Everyone Read: all logged-in users can access the unit with read permission. Read permission of issues/pull-requests units also means users can create new issues/pull-requests.
settings.public_access.docs.everyone_write = Everyone Write: all logged-in users have write permission to the unit. Only Wiki unit supports this permission.
settings.collaboration = Collaborators
settings.collaboration.admin = Administrator
settings.collaboration.write = Write

View File

@ -1,36 +1,54 @@
{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings")}}
<div class="repo-setting-content">
{{$paNotSet := "not-set"}}
{{$paAnonymousRead := "anonymous-read"}}
{{$paEveryoneRead := "everyone-read"}}
{{$paEveryoneWrite := "everyone-write"}}
<form class="ui form" method="post">
{{.CsrfTokenHtml}}
<table class="ui table unstackable tw-my-2">
<tr>
<th></th>
<th>{{ctx.Locale.Tr "settings.permission_not_set"}}</th>
<th>{{ctx.Locale.Tr "settings.permission_anonymous_read"}}</th>
<th>{{ctx.Locale.Tr "settings.permission_everyone_read"}}</th>
<th>{{ctx.Locale.Tr "settings.permission_everyone_write"}}</th>
</tr>
{{range $ua := .RepoUnitPublicAccesses}}
<tr>
<td>{{$ua.DisplayName}}</td>
<td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paNotSet}}" {{Iif (eq $paNotSet $ua.UnitPublicAccess) "checked"}}></label></td>
<td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paAnonymousRead}}" {{Iif (eq $paAnonymousRead $ua.UnitPublicAccess) "checked"}}></label></td>
<td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paEveryoneRead}}" {{Iif (eq $paEveryoneRead $ua.UnitPublicAccess) "checked"}}></label></td>
<td class="tw-text-center">
{{if SliceUtils.Contains $ua.PublicAccessTypes $paEveryoneWrite}}
<label><input type="radio" name="{{$ua.FormKey}}" value="{{$paEveryoneWrite}}" {{Iif (eq $paEveryoneWrite $ua.UnitPublicAccess) "checked"}}></label>
{{else}}
-
{{end}}
</td>
</tr>
{{end}}
</table>
<button class="ui primary button {{if .GlobalForcePrivate}}disabled{{end}}">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
</form>
<h4 class="ui top attached header">
{{ctx.Locale.Tr "repo.settings.public_access"}}
</h4>
<div class="ui attached segment">
<p>
{{ctx.Locale.Tr "repo.settings.public_access_desc"}}
</p>
{{$paNotSet := "not-set"}}
{{$paAnonymousRead := "anonymous-read"}}
{{$paEveryoneRead := "everyone-read"}}
{{$paEveryoneWrite := "everyone-write"}}
<form class="ui form" method="post">
{{.CsrfTokenHtml}}
<table class="ui table unstackable tw-my-2">
<thead>
<tr>
<th>{{ctx.Locale.Tr "units.unit"}}</th>
<th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_not_set"}}</th>
<th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_anonymous_read"}}</th>
<th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_everyone_read"}}</th>
<th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_everyone_write"}}</th>
</tr>
</thead>
<tbody>
{{range $ua := .RepoUnitPublicAccesses}}
<tr>
<td>{{$ua.DisplayName}}</td>
<td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paNotSet}}" {{Iif (eq $paNotSet $ua.UnitPublicAccess) "checked"}}></label></td>
<td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paAnonymousRead}}" {{Iif (eq $paAnonymousRead $ua.UnitPublicAccess) "checked"}}></label></td>
<td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paEveryoneRead}}" {{Iif (eq $paEveryoneRead $ua.UnitPublicAccess) "checked"}}></label></td>
<td class="tw-text-center">
{{if SliceUtils.Contains $ua.PublicAccessTypes $paEveryoneWrite}}
<label><input type="radio" name="{{$ua.FormKey}}" value="{{$paEveryoneWrite}}" {{Iif (eq $paEveryoneWrite $ua.UnitPublicAccess) "checked"}}></label>
{{else}}
-
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
<ul class="tw-my-3 tw-pl-5 tw-flex tw-flex-col tw-gap-3">
<li>{{ctx.Locale.Tr "repo.settings.public_access.docs.not_set"}}</li>
<li>{{ctx.Locale.Tr "repo.settings.public_access.docs.anonymous_read"}}</li>
<li>{{ctx.Locale.Tr "repo.settings.public_access.docs.everyone_read"}}</li>
<li>{{ctx.Locale.Tr "repo.settings.public_access.docs.everyone_write"}}</li>
</ul>
<button class="ui primary button {{if .GlobalForcePrivate}}disabled{{end}}">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
</form>
</div>
</div>
{{template "repo/settings/layout_footer" .}}