2023-04-23 18:21:21 +08:00
|
|
|
{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings collaboration")}}
|
|
|
|
|
<div class="repo-setting-content">
|
2017-03-15 22:39:38 +00:00
|
|
|
<h4 class="ui top attached header">
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.collaboration"}}
|
2017-03-15 22:39:38 +00:00
|
|
|
</h4>
|
2017-04-23 02:55:02 +02:00
|
|
|
{{if .Collaborators}}
|
2023-08-01 00:13:42 +02:00
|
|
|
<div class="ui attached segment">
|
|
|
|
|
<div class="flex-list">
|
|
|
|
|
{{range .Collaborators}}
|
2024-03-22 20:51:29 +01:00
|
|
|
<div class="flex-item tw-items-center">
|
2023-08-01 00:13:42 +02:00
|
|
|
<div class="flex-item-leading">
|
2023-08-10 11:19:39 +08:00
|
|
|
<a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 32}}</a>
|
2023-08-01 00:13:42 +02:00
|
|
|
</div>
|
|
|
|
|
<div class="flex-item-main">
|
|
|
|
|
<div class="flex-item-title">
|
|
|
|
|
{{template "shared/user/name" .}}
|
2016-03-05 18:08:42 -05:00
|
|
|
</div>
|
2015-12-07 23:30:52 +01:00
|
|
|
</div>
|
2023-08-01 00:13:42 +02:00
|
|
|
<div class="flex-item-trailing">
|
|
|
|
|
<div class="flex-text-block">
|
|
|
|
|
{{svg "octicon-shield-lock"}}
|
2024-06-10 12:12:31 +02:00
|
|
|
<div class="ui dropdown custom access-mode" data-url="{{$.Link}}/access_mode" data-uid="{{.ID}}" data-last-value="{{.Collaboration.Mode}}">
|
2023-09-25 20:42:40 +08:00
|
|
|
<div class="text">{{if eq .Collaboration.Mode 1}}{{ctx.Locale.Tr "repo.settings.collaboration.read"}}{{else if eq .Collaboration.Mode 2}}{{ctx.Locale.Tr "repo.settings.collaboration.write"}}{{else if eq .Collaboration.Mode 3}}{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}{{else}}{{ctx.Locale.Tr "repo.settings.collaboration.undefined"}}{{end}}</div>
|
2023-08-01 00:13:42 +02:00
|
|
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
|
|
|
|
<div class="menu">
|
2024-06-10 12:12:31 +02:00
|
|
|
<div class="item" data-value="3">{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}</div>
|
|
|
|
|
<div class="item" data-value="2">{{ctx.Locale.Tr "repo.settings.collaboration.write"}}</div>
|
|
|
|
|
<div class="item" data-value="1">{{ctx.Locale.Tr "repo.settings.collaboration.read"}}</div>
|
2023-08-01 00:13:42 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-07-06 00:01:53 +08:00
|
|
|
<button class="ui red tiny button link-action" data-modal-confirm="#repo-collaborator-delete-modal" data-url="{{$.Link}}/delete?id={{.ID}}">
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.delete_collaborator"}}
|
2023-08-01 00:13:42 +02:00
|
|
|
</button>
|
|
|
|
|
</div>
|
2017-03-15 22:39:38 +00:00
|
|
|
</div>
|
2023-08-01 00:13:42 +02:00
|
|
|
{{end}}
|
|
|
|
|
</div>
|
2017-03-15 22:39:38 +00:00
|
|
|
</div>
|
2017-04-23 02:55:02 +02:00
|
|
|
{{end}}
|
2017-03-15 22:39:38 +00:00
|
|
|
<div class="ui bottom attached segment">
|
|
|
|
|
<form class="ui form" id="repo-collab-form" action="{{.Link}}" method="post">
|
2024-03-22 14:45:10 +01:00
|
|
|
<div id="search-user-box" class="ui search input tw-align-middle">
|
2024-06-26 02:54:18 +12:00
|
|
|
<input class="prompt" name="collaborator" placeholder="{{ctx.Locale.Tr "search.user_kind"}}" autocomplete="off" autofocus required>
|
2015-12-07 23:30:52 +01:00
|
|
|
</div>
|
2023-09-25 10:56:50 +02:00
|
|
|
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_collaborator"}}</button>
|
2017-03-15 22:39:38 +00:00
|
|
|
</form>
|
2015-12-07 23:30:52 +01:00
|
|
|
</div>
|
2019-09-23 22:08:03 +02:00
|
|
|
|
2025-01-12 11:39:46 +08:00
|
|
|
{{if $.Repository.Owner.IsOrganization}}
|
|
|
|
|
<h4 class="ui top attached header">
|
|
|
|
|
{{ctx.Locale.Tr "repo.settings.teams"}}
|
|
|
|
|
</h4>
|
|
|
|
|
{{$allowedToChangeTeams := (or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner))}}
|
|
|
|
|
{{if .Teams}}
|
|
|
|
|
<div class="ui attached segment">
|
|
|
|
|
<div class="flex-list">
|
|
|
|
|
{{range $t, $team := .Teams}}
|
|
|
|
|
<div class="flex-item">
|
|
|
|
|
<div class="flex-item-main">
|
2026-02-22 23:56:33 +01:00
|
|
|
<a class="flex-item-title tw-text-primary" href="{{AppSubUrl}}/org/{{$.OrgName|PathEscape}}/teams/{{.LowerName|PathEscape}}">
|
2025-01-12 11:39:46 +08:00
|
|
|
{{.Name}}
|
|
|
|
|
</a>
|
|
|
|
|
<div class="flex-item-body flex-text-block">
|
2025-06-24 21:24:09 +08:00
|
|
|
{{/*FIXME: TEAM-UNIT-PERMISSION this display is not right, search the fixme keyword to see more details */}}
|
2025-01-12 11:39:46 +08:00
|
|
|
{{svg "octicon-shield-lock"}}
|
2025-06-24 21:24:09 +08:00
|
|
|
{{if eq .AccessMode 0}}
|
|
|
|
|
{{ctx.Locale.Tr "repo.settings.collaboration.per_unit"}}
|
|
|
|
|
{{else if eq .AccessMode 1}}
|
|
|
|
|
{{ctx.Locale.Tr "repo.settings.collaboration.read"}}
|
|
|
|
|
{{else if eq .AccessMode 2}}
|
|
|
|
|
{{ctx.Locale.Tr "repo.settings.collaboration.write"}}
|
|
|
|
|
{{else if eq .AccessMode 3}}
|
|
|
|
|
{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}
|
|
|
|
|
{{else if eq .AccessMode 4}}
|
|
|
|
|
{{ctx.Locale.Tr "repo.settings.collaboration.owner"}}
|
|
|
|
|
{{else}}
|
|
|
|
|
{{ctx.Locale.Tr "repo.settings.collaboration.undefined"}}
|
|
|
|
|
{{end}}
|
2025-01-12 11:39:46 +08:00
|
|
|
</div>
|
2025-06-24 21:24:09 +08:00
|
|
|
{{if or (eq .AccessMode 0) (eq .AccessMode 1) (eq .AccessMode 2)}}
|
2025-01-12 11:39:46 +08:00
|
|
|
{{$first := true}}
|
|
|
|
|
<div class="flex-item-body" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.change_team_permission_tip"}}">
|
2025-06-24 21:24:09 +08:00
|
|
|
Units:
|
|
|
|
|
{{range $u, $unit := $.Units}}
|
|
|
|
|
{{- if and ($.Repo.UnitEnabled ctx $unit.Type) ($team.UnitEnabled ctx $unit.Type) -}}
|
|
|
|
|
{{- Iif $first "" ", "}}{{ctx.Locale.Tr $unit.NameKey -}}
|
|
|
|
|
{{- $first = false -}}
|
|
|
|
|
{{- end -}}
|
|
|
|
|
{{end}}
|
|
|
|
|
{{if $first}}None{{end}}
|
2025-01-12 11:39:46 +08:00
|
|
|
</div>
|
|
|
|
|
{{end}}
|
2023-08-01 00:13:42 +02:00
|
|
|
</div>
|
2025-01-12 11:39:46 +08:00
|
|
|
{{if $allowedToChangeTeams}}
|
|
|
|
|
<div class="flex-item-trailing" {{if .IncludesAllRepositories}} data-tooltip-content="{{ctx.Locale.Tr "repo.settings.delete_team_tip"}}"{{end}}>
|
2025-07-06 00:01:53 +08:00
|
|
|
<button class="ui red tiny button link-action {{if .IncludesAllRepositories}}disabled{{end}}" data-modal-confirm="#repo-collaborator-delete-modal" data-url="{{$.Link}}/team/delete?id={{.ID}}">
|
2025-01-12 11:39:46 +08:00
|
|
|
{{ctx.Locale.Tr "repo.settings.delete_collaborator"}}
|
|
|
|
|
</button>
|
2023-08-01 00:13:42 +02:00
|
|
|
</div>
|
|
|
|
|
{{end}}
|
2019-09-23 22:08:03 +02:00
|
|
|
</div>
|
2025-01-12 11:39:46 +08:00
|
|
|
{{end}}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{{end}}
|
|
|
|
|
<div class="ui bottom attached segment">
|
|
|
|
|
{{if $allowedToChangeTeams}}
|
|
|
|
|
<form class="ui form" id="repo-collab-team-form" action="{{.Link}}/team" method="post">
|
|
|
|
|
<div id="search-team-box" class="ui search input tw-align-middle" data-org-name="{{.OrgName}}">
|
2025-05-09 02:26:18 +08:00
|
|
|
<input class="prompt" name="team" placeholder="{{ctx.Locale.Tr "search.team_kind"}}" autocomplete="off" required>
|
2025-01-12 11:39:46 +08:00
|
|
|
</div>
|
|
|
|
|
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_team"}}</button>
|
|
|
|
|
</form>
|
|
|
|
|
{{else}}
|
|
|
|
|
<div class="item">
|
|
|
|
|
{{ctx.Locale.Tr "repo.settings.change_team_access_not_allowed"}}
|
2019-09-23 22:08:03 +02:00
|
|
|
</div>
|
2023-08-01 00:13:42 +02:00
|
|
|
{{end}}
|
|
|
|
|
</div>
|
2019-09-24 03:30:40 +02:00
|
|
|
{{end}}
|
2014-08-07 06:40:05 -04:00
|
|
|
</div>
|
2016-03-05 18:08:42 -05:00
|
|
|
|
2025-07-06 00:01:53 +08:00
|
|
|
<div class="ui small modal" id="repo-collaborator-delete-modal">
|
|
|
|
|
<div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.settings.collaborator_deletion"}}</div>
|
|
|
|
|
<div class="content"><p>{{ctx.Locale.Tr "repo.settings.collaborator_deletion_desc"}}</p></div>
|
2023-04-23 17:24:19 +08:00
|
|
|
{{template "base/modal_actions_confirm" .}}
|
2016-03-05 18:08:42 -05:00
|
|
|
</div>
|
2023-04-23 18:21:21 +08:00
|
|
|
|
|
|
|
|
{{template "repo/settings/layout_footer" .}}
|