Skip to content

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

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

Merged
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
5 changes: 5 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
82 changes: 50 additions & 32 deletions templates/repo/settings/public_access.tmpl
Original file line number Diff line number Diff line change
@@ -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" .}}