From 134e86c78c4c9f356c5853be5149778c8e61160f Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sun, 3 May 2026 00:10:52 +0800 Subject: [PATCH] Refactor "flex-list" to "flex-divided-list" (#37505) Purpose: 1. Make the whole code base have unified "item" layout 2. Clarify our "list" styles: "flex-relaxed-list", "flex-divided-list" 3. Prepare to replace legacy "ui relaxed list" * https://github.com/go-gitea/gitea/pull/37445#discussion_r3144458865 4. Prepare for refactoring the "pull merge box", it needs the "flex-divided-list" * related to "Refactor pull request view (*)" like #37451 5. Fix legacy abuses of "flex-list", e.g.: repo home sidebar --- templates/admin/badge/users.tmpl | 12 +- templates/admin/badge/view.tmpl | 12 +- templates/admin/user/view_details.tmpl | 28 ++--- templates/admin/user/view_emails.tmpl | 6 +- templates/devtest/flex-list.tmpl | 93 ++++++++------ templates/devtest/fomantic-dropdown.tmpl | 2 +- templates/explore/user_list.tmpl | 14 +-- templates/org/member/members.tmpl | 12 +- .../org/settings/options_dangerzone.tmpl | 32 ++--- templates/org/team/members.tmpl | 24 ++-- templates/org/team/repositories.tmpl | 14 +-- templates/package/settings.tmpl | 12 +- .../package/shared/cleanup_rules/list.tmpl | 22 ++-- templates/package/shared/list.tmpl | 10 +- templates/package/shared/versionlist.tmpl | 10 +- templates/repo/actions/runs_list.tmpl | 14 +-- templates/repo/header.tmpl | 31 ++--- templates/repo/home_sidebar_bottom.tmpl | 90 ++++++-------- templates/repo/home_sidebar_top.tmpl | 115 ++++++++---------- templates/repo/settings/actions_general.tmpl | 12 +- templates/repo/settings/branches.tmpl | 12 +- templates/repo/settings/collaboration.tmpl | 26 ++-- templates/repo/settings/deploy_keys.tmpl | 16 +-- templates/repo/settings/options.tmpl | 78 ++++++------ templates/shared/issuelist.tmpl | 18 +-- templates/shared/repo/list.tmpl | 18 +-- templates/shared/secrets/add_list.tmpl | 16 +-- templates/shared/user/blocked_users.tmpl | 14 +-- templates/shared/variables/variable_list.tmpl | 16 +-- templates/user/dashboard/feeds.tmpl | 16 +-- templates/user/settings/applications.tmpl | 16 +-- .../settings/applications_oauth2_list.tmpl | 16 +-- templates/user/settings/grants_oauth2.tmpl | 16 +-- templates/user/settings/keys_gpg.tmpl | 16 +-- templates/user/settings/keys_principal.tmpl | 16 +-- templates/user/settings/keys_ssh.tmpl | 22 ++-- templates/user/settings/organization.tmpl | 12 +- .../user/settings/security/accountlinks.tmpl | 14 +-- templates/user/settings/security/openid.tmpl | 14 +-- .../user/settings/security/webauthn.tmpl | 14 +-- tests/e2e/issue-project.test.ts | 2 +- tests/integration/auth_ldap_test.go | 2 +- tests/integration/issue_test.go | 2 +- tests/integration/privateactivity_test.go | 2 +- tests/integration/repo_fork_test.go | 2 +- web_src/css/actions.css | 4 +- web_src/css/base.css | 7 -- web_src/css/index.css | 1 - web_src/css/repo.css | 9 ++ web_src/css/repo/header.css | 29 ----- web_src/css/repo/home.css | 9 +- web_src/css/repo/issue-list.css | 12 +- web_src/css/shared/flex-list.css | 79 ++++++++---- .../features/repo-settings-branches.test.ts | 6 +- 54 files changed, 560 insertions(+), 557 deletions(-) delete mode 100644 web_src/css/repo/header.css diff --git a/templates/admin/badge/users.tmpl b/templates/admin/badge/users.tmpl index 97d332010f3..711110ca68a 100644 --- a/templates/admin/badge/users.tmpl +++ b/templates/admin/badge/users.tmpl @@ -13,18 +13,18 @@ {{if .Users}}
-
+
{{range .Users}} -
-
+
+ -
-
+
+
{{template "shared/user/name" .}}
-
+
{{ctx.Locale.Tr "admin.badges.remove_user"}} diff --git a/templates/admin/badge/view.tmpl b/templates/admin/badge/view.tmpl index efd31f4c411..cbe5c7b7102 100644 --- a/templates/admin/badge/view.tmpl +++ b/templates/admin/badge/view.tmpl @@ -10,18 +10,18 @@
-
-
+
+
{{if .Badge.ImageURL}} -
+
{{.Badge.Description}}
{{end}} -
-
+
+
{{.Badge.Slug}}
-
+
{{.Badge.Description}}
diff --git a/templates/admin/user/view_details.tmpl b/templates/admin/user/view_details.tmpl index db61bc93597..45fb83d1259 100644 --- a/templates/admin/user/view_details.tmpl +++ b/templates/admin/user/view_details.tmpl @@ -1,10 +1,10 @@ -
-
-
+
+
+
{{ctx.AvatarUtils.Avatar .User 48}}
-
-
+
+
{{template "shared/user/name" .User}} {{if .User.IsAdmin}} {{ctx.Locale.Tr "admin.users.admin"}} @@ -13,34 +13,34 @@ {{ctx.Locale.Tr "admin.users.bot"}} {{end}}
-
+
{{ctx.Locale.Tr "admin.users.auth_source"}}: {{Iif (eq .LoginSource.ID 0) (ctx.Locale.Tr "admin.users.local") .LoginSource.Name}}
-
+
{{ctx.Locale.Tr "admin.users.activated"}}: {{svg (Iif .User.IsActive "octicon-check" "octicon-x")}}
-
+
{{ctx.Locale.Tr "admin.users.prohibit_login"}}: {{svg (Iif .User.ProhibitLogin "octicon-check" "octicon-x")}}
-
+
{{ctx.Locale.Tr "admin.users.restricted"}}: {{svg (Iif .User.IsRestricted "octicon-check" "octicon-x")}}
-
+
{{ctx.Locale.Tr "settings.visibility"}}: {{if .User.Visibility.IsPublic}}{{ctx.Locale.Tr "settings.visibility.public"}}{{end}} {{if .User.Visibility.IsLimited}}{{ctx.Locale.Tr "settings.visibility.limited"}}{{end}} {{if .User.Visibility.IsPrivate}}{{ctx.Locale.Tr "settings.visibility.private"}}{{end}}
-
+
{{ctx.Locale.Tr "admin.users.2fa"}}: {{svg (Iif .TwoFactorEnabled "octicon-check" "octicon-x")}}
{{if .User.Language}} -
+
{{ctx.Locale.Tr "settings.language"}}: {{range .AllLangs}}{{if eq $.User.Language .Lang}}{{.Name}}{{end}}{{end}} @@ -48,12 +48,12 @@
{{end}} {{if .User.Location}} -
+
{{svg "octicon-location"}}{{.User.Location}}
{{end}} {{if .User.Website}} -
+
{{svg "octicon-link"}} {{.User.Website}} diff --git a/templates/admin/user/view_emails.tmpl b/templates/admin/user/view_emails.tmpl index 7e77206f1c7..29f059e05fb 100644 --- a/templates/admin/user/view_emails.tmpl +++ b/templates/admin/user/view_emails.tmpl @@ -1,7 +1,7 @@ -
+
{{range .Emails}} -
-
+
+
{{.Email}} {{if .IsPrimary}} diff --git a/templates/devtest/flex-list.tmpl b/templates/devtest/flex-list.tmpl index c0863ba4f0c..de59473a703 100644 --- a/templates/devtest/flex-list.tmpl +++ b/templates/devtest/flex-list.tmpl @@ -1,28 +1,28 @@ {{template "devtest/devtest-header"}}
-

Flex List (standalone)

+

Flex List (standalone)

-
-
-
+
+
+
{{svg "octicon-info" 32}}
-
-
+
+
Flex Item with label
-
+
consists of leading/main/trailing part
-
+
main part contains title and (multiple) body lines
-
+
@@ -35,42 +35,42 @@
-
-
+
+
{{svg "octicon-info" 32}}
-
-
+
+
Very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong title
-
+
consists of leading/main/trailing part
-
+
Very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong content Truncate very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong content
-
+
-
-
+
+
{{svg "octicon-repo" 32}}
-
-
-
+
+
+
gitea-org / gitea {{svg "octicon-repo-forked"}}
- -
+
when inside header, the trailing part will wrap below the title
@@ -87,27 +87,48 @@
-

Flex List (with "ui segment")

+

Flex List (with "ui segment")

-
-
item 1
-
item 2
+
+
item 1
+
item 2
-

Flex List (with "ui segment")

-
-
item 1
-
item 2
+

segment header

+
+
item 1
+
item 2
+
+
+

Flex List (with "ui segment fitted")

+
+
+
item 1
+
item 2
-

If parent provides the padding/margin space:

-
-
-
item 1 (no padding top)
-
item 2 (no padding bottom)
+

If parent provides border or padding:

+
+
before divider
+
+
+
item 1
+
item 2
+
+
after divider
+
+
+
before divider
+
+
+
item 1
+
item 2
+
+
+
after divider
diff --git a/templates/devtest/fomantic-dropdown.tmpl b/templates/devtest/fomantic-dropdown.tmpl index a10dc890cef..8fea2307689 100644 --- a/templates/devtest/fomantic-dropdown.tmpl +++ b/templates/devtest/fomantic-dropdown.tmpl @@ -4,7 +4,7 @@

Dropdown