From 3b250ba04e126f70ac6fa388ae90d508996ed21d Mon Sep 17 00:00:00 2001 From: xiaox <827812965@qq.com> Date: Sat, 28 Feb 2026 21:03:25 +0800 Subject: [PATCH] refactor: replace legacy tw-flex utility classes with flex-text-block/inline (#36778) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Replace combinations of `tw-flex tw-items-center` (with optional `tw-gap-*`) with semantic `flex-text-block` or `flex-text-inline` classes across 15 template files. This follows the refactoring direction outlined in #35015 ("Refactor legacy `tw-flex tw-items-center tw-gap-xx` to `flex-text-block` or `flex-text-inline`"). ## Changes ### Replacement rules applied: - `tw-flex tw-items-center tw-gap-2` → `flex-text-block` (both have `gap: 0.5rem`) - `tw-flex tw-items-center tw-gap-1` → `flex-text-inline` (both have `gap: 0.25rem`) - `tw-flex tw-items-center` (no explicit gap) → `flex-text-block` where the element is block-level and children benefit from the default gap - `tw-flex tw-items-center` (inline context, e.g. ``, ``) → `flex-text-inline` ### Files modified (15): - `templates/admin/config.tmpl` — config page dt elements - `templates/admin/repo/unadopted.tmpl` — unadopted repo list items - `templates/base/head_navbar.tmpl` — active stopwatch popup - `templates/org/header.tmpl` — org header action buttons - `templates/org/home.tmpl` — member/team count links - `templates/org/settings/labels.tmpl` — labels page header - `templates/repo/branch/list.tmpl` — branch list header - `templates/repo/commits_table.tmpl` — commits table header - `templates/repo/diff/box.tmpl` — diff detail box - `templates/repo/diff/new_review.tmpl` — review form header - `templates/repo/issue/card.tmpl` — issue card unpin button - `templates/repo/issue/view_content/attachments.tmpl` — attachment file size - `templates/repo/migrate/migrate.tmpl` — migration service cards - `templates/shared/user/org_profile_avatar.tmpl` — org profile header - `templates/webhook/new.tmpl` — webhook type dropdown text ### What was NOT changed: - Elements with `tw-justify-between` or `tw-justify-center` (these need additional classes) - Elements whose children use explicit margins (`tw-mr-*`, `tw-ml-*`) that would conflict with the gap from flex-text classes - Fomantic UI form elements with special layout requirements ## Notes - This PR was created with AI assistance (Claude). All changes were reviewed individually to ensure semantic correctness and zero unintended visual changes. - No functional changes — purely CSS class refactoring. Closes: part of #35015 Signed-off-by: xiaox315 Co-authored-by: xiaox315 --- templates/admin/config.tmpl | 4 ++-- templates/admin/repo/unadopted.tmpl | 2 +- templates/base/head_navbar.tmpl | 4 ++-- templates/org/header.tmpl | 2 +- templates/org/home.tmpl | 4 ++-- templates/org/settings/labels.tmpl | 2 +- templates/repo/branch/list.tmpl | 2 +- templates/repo/commits_table.tmpl | 2 +- templates/repo/diff/box.tmpl | 2 +- templates/repo/diff/new_review.tmpl | 2 +- templates/repo/issue/card.tmpl | 2 +- templates/repo/issue/view_content/attachments.tmpl | 2 +- templates/repo/migrate/migrate.tmpl | 2 +- templates/shared/user/org_profile_avatar.tmpl | 2 +- templates/webhook/new.tmpl | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index a61dec9620..6dc6e0d5ea 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -223,7 +223,7 @@
{{ctx.Locale.Tr "admin.config.mailer_user"}}
{{if .Mailer.User}}{{.Mailer.User}}{{else}}(empty){{end}}
-
{{ctx.Locale.Tr "admin.config.send_test_mail"}}
+
{{ctx.Locale.Tr "admin.config.send_test_mail"}}
@@ -254,7 +254,7 @@
{{.CacheItemTTL}}
{{end}}
-
{{ctx.Locale.Tr "admin.config.cache_test"}}
+
{{ctx.Locale.Tr "admin.config.cache_test"}}
diff --git a/templates/admin/repo/unadopted.tmpl b/templates/admin/repo/unadopted.tmpl index 54b76c08bc..e66add6ce8 100644 --- a/templates/admin/repo/unadopted.tmpl +++ b/templates/admin/repo/unadopted.tmpl @@ -20,7 +20,7 @@ {{if .Dirs}}
{{range $dirI, $dir := .Dirs}} -
+
{{svg "octicon-file-directory-fill"}} {{$dir}}
diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 28fcee023f..43cbcbdc0c 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -151,8 +151,8 @@ {{$activeStopwatch := and .PageGlobalData (call .PageGlobalData.GetActiveStopwatch)}} {{if $activeStopwatch}}
-
- +
+ {{svg "octicon-issue-opened" 16}} {{$activeStopwatch.RepoSlug}}#{{$activeStopwatch.IssueIndex}} diff --git a/templates/org/header.tmpl b/templates/org/header.tmpl index 040164ba86..31f43449ab 100644 --- a/templates/org/header.tmpl +++ b/templates/org/header.tmpl @@ -7,7 +7,7 @@ {{if .Org.Visibility.IsLimited}}{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}{{end}} {{if .Org.Visibility.IsPrivate}}{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}{{end}} - + {{if .EnableFeed}} {{svg "octicon-rss" 24}} diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index ea294980e0..ab088ce7b2 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -49,7 +49,7 @@ {{if .NumMembers}}

{{ctx.Locale.Tr "org.members"}} - {{.NumMembers}} {{svg "octicon-chevron-right"}} + {{.NumMembers}} {{svg "octicon-chevron-right"}}

{{$isMember := .IsOrganizationMember}} @@ -63,7 +63,7 @@ {{if .IsOrganizationMember}}
{{range .Teams}} diff --git a/templates/org/settings/labels.tmpl b/templates/org/settings/labels.tmpl index 21d7c0ef3c..283b2199cb 100644 --- a/templates/org/settings/labels.tmpl +++ b/templates/org/settings/labels.tmpl @@ -1,6 +1,6 @@ {{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings labels")}}
-
+
{{ctx.Locale.Tr "org.settings.labels_desc"}}
diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 593b9d454d..5e0d07ed6d 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -71,7 +71,7 @@ {{end}}

-
+
{{ctx.Locale.Tr "repo.branches"}}

diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index c8ae535a18..8f6e6e0169 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -1,5 +1,5 @@

-
+
{{if or .PageIsCommits (gt .CommitCount 0)}} {{.CommitCount}} {{ctx.Locale.Tr "repo.commits.commits"}} {{else if .IsNothingToCompare}} diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 41a8268cb3..3a152a7e81 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -1,7 +1,7 @@ {{$showFileTree := (and (not .DiffNotAvailable) (gt .DiffShortStat.NumFiles 1))}}
-
+
{{if $showFileTree}}