Refactor "org teams" page and help new users to "add member" to an org (#37051)

* Fix #22054
* Replace #34593, #27800
* And refactor legacy code, fix various problems

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
wxiaoguang
2026-03-31 21:30:25 +08:00
committed by GitHub
parent 6ca5573718
commit d288b4529b
8 changed files with 73 additions and 85 deletions
+8 -2
View File
@@ -7,9 +7,11 @@
{{template "org/team/sidebar" .}}
<div class="ui ten wide column">
{{template "org/team/navbar" .}}
{{$hasTopAttachedSegment := false}}
{{$canAddRemove := and $.IsOrganizationOwner (not $.Team.IncludesAllRepositories)}}
{{if $canAddRemove}}
<div class="ui top attached segment tw-flex tw-flex-wrap tw-gap-2">
{{$hasTopAttachedSegment = true}}
<div class="ui top attached segment flex-text-block tw-flex-wrap">
<form class="ui form ignore-dirty tw-flex-1 tw-flex" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/add" method="post">
<div data-global-init="initSearchRepoBox" data-uid="{{.Org.ID}}" class="ui search">
<div class="ui input">
@@ -24,7 +26,11 @@
</div>
</div>
{{end}}
<div class="ui{{if not $canAddRemove}} top{{end}} attached segment">
{{if $.Team.IncludesAllRepositories}}
{{$hasTopAttachedSegment = true}}
<div class="ui top attached segment">{{ctx.Locale.Tr "org.teams.all_repositories"}}</div>
{{end}}
<div class="ui {{if not $hasTopAttachedSegment}}top{{end}} attached segment">
<div class="flex-list">
{{range $.TeamRepos}}
<div class="flex-item tw-items-center">
+2 -1
View File
@@ -26,7 +26,8 @@
</div>
{{if eq .Team.LowerName "owners"}}
<div class="item">
{{ctx.Locale.Tr "org.teams.owners_permission_desc"}}
<p>{{ctx.Locale.Tr "org.teams.owners_permission_desc"}}</p>
<p>{{ctx.Locale.Tr "org.teams.owners_permission_suggestion"}}</p>
</div>
{{else}}
<div class="item">
+2 -1
View File
@@ -4,7 +4,8 @@
<div class="ui container">
{{template "base/alert" .}}
{{if .IsOrganizationOwner}}
<div class="flex-text-block tw-justify-end">
<div class="flex-text-block">
<div class="tw-flex-1">{{ctx.Locale.Tr "org.teams.manage_team_member_prompt"}}</div>
<a class="ui primary button" href="{{.OrgLink}}/teams/new">{{svg "octicon-plus"}} {{ctx.Locale.Tr "org.create_new_team"}}</a>
</div>
<div class="divider"></div>