{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings collaboration")}}

{{.locale.Tr "repo.settings.collaboration"}}

{{if .Collaborators}}
{{range .Collaborators}}
{{template "shared/user/name" .}}
{{svg "octicon-shield-lock"}}
{{end}}
{{end}}
{{.CsrfTokenHtml}}
{{if .RepoOwnerIsOrganization}}

{{$.locale.Tr "repo.settings.teams"}}

{{$allowedToChangeTeams := (or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner))}} {{if .Teams}}
{{range $t, $team := .Teams}}
{{.Name}}
{{svg "octicon-shield-lock"}} {{if eq .AccessMode 1}}{{$.locale.Tr "repo.settings.collaboration.read"}}{{else if eq .AccessMode 2}}{{$.locale.Tr "repo.settings.collaboration.write"}}{{else if eq .AccessMode 3}}{{$.locale.Tr "repo.settings.collaboration.admin"}}{{else if eq .AccessMode 4}}{{$.locale.Tr "repo.settings.collaboration.owner"}}{{else}}{{$.locale.Tr "repo.settings.collaboration.undefined"}}{{end}}
{{if or (eq .AccessMode 1) (eq .AccessMode 2)}} {{$first := true}}
Sections: {{range $u, $unit := $.Units}}{{if and ($.Repo.UnitEnabled $.Context $unit.Type) ($team.UnitEnabled $.Context $unit.Type)}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{$.locale.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}}
{{end}}
{{if $allowedToChangeTeams}}
{{end}}
{{end}}
{{end}}
{{if $allowedToChangeTeams}}
{{.CsrfTokenHtml}}
{{else}}
{{$.locale.Tr "repo.settings.change_team_access_not_allowed"}}
{{end}}
{{end}}
{{template "repo/settings/layout_footer" .}}