From ed2ca46f30e1e53a1ccb1dea386ba2b04366659b Mon Sep 17 00:00:00 2001 From: Animesh Kumar <83393501+kmranimesh@users.noreply.github.com> Date: Wed, 11 Feb 2026 00:16:39 +0530 Subject: [PATCH] feat: add pagination, search, and description to org teams page Add pagination and keyword search to the organization teams list page. Display team descriptions in team cards. - Refactor Teams() handler to use SearchTeam() with ListOptions for server-side pagination and keyword filtering - Add search input with the existing 'search.team_kind' locale string - Show team description in an attached segment below the team name - Add standard pagination widget at the bottom of the list Fixes go-gitea/gitea#34482 --- routers/web/org/teams.go | 33 +++++++++++++++++++++++++++++++-- templates/org/team/teams.tmpl | 20 +++++++++++++++++++- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/routers/web/org/teams.go b/routers/web/org/teams.go index 0ec7cfddc5..d72484d728 100644 --- a/routers/web/org/teams.go +++ b/routers/web/org/teams.go @@ -54,13 +54,42 @@ func Teams(ctx *context.Context) { ctx.Data["Title"] = org.FullName ctx.Data["PageIsOrgTeams"] = true - for _, t := range ctx.Org.Teams { + page := max(ctx.FormInt("page"), 1) + keyword := ctx.FormTrim("q") + + opts := &org_model.SearchTeamOptions{ + Keyword: keyword, + OrgID: org.ID, + IncludeDesc: true, + ListOptions: db.ListOptions{ + Page: page, + PageSize: setting.UI.MembersPagingNum, + }, + } + + if !ctx.Org.IsOwner { + opts.UserID = ctx.Doer.ID + } + + teams, count, err := org_model.SearchTeam(ctx, opts) + if err != nil { + ctx.ServerError("SearchTeam", err) + return + } + + for _, t := range teams { if err := t.LoadMembers(ctx); err != nil { ctx.ServerError("GetMembers", err) return } } - ctx.Data["Teams"] = ctx.Org.Teams + + pager := context.NewPagination(int(count), setting.UI.MembersPagingNum, page, 5) + pager.AddParamFromRequest(ctx.Req) + ctx.Data["Page"] = pager + ctx.Data["Teams"] = teams + ctx.Data["Keyword"] = keyword + ctx.Data["Total"] = count ctx.HTML(http.StatusOK, tplTeams) } diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl index 50f4f7e97d..85ace44bc0 100644 --- a/templates/org/team/teams.tmpl +++ b/templates/org/team/teams.tmpl @@ -7,9 +7,19 @@
{{svg "octicon-plus"}} {{ctx.Locale.Tr "org.create_new_team"}}
-
{{end}} + + +
+
{{range .Teams}}
@@ -30,6 +40,11 @@ {{end}}
+ {{if .Description}} +
+

{{.Description}}

+
+ {{end}}
{{range .Members}} {{template "shared/user/avatarlink" dict "user" .}} @@ -41,6 +56,8 @@
{{end}} + + {{template "base/paginate" .}} {{template "base/footer" .}} +