mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-03 06:36:05 +01:00
refactor: replace legacy tw-flex utility classes with flex-text-block/inline (#36778)
## 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. `<a>`, `<span>`) → `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 <xiaox315@users.noreply.github.com> Co-authored-by: xiaox315 <xiaox315@users.noreply.github.com>
This commit is contained in:
parent
2e00b2f0bb
commit
3b250ba04e
@ -223,7 +223,7 @@
|
||||
<dt>{{ctx.Locale.Tr "admin.config.mailer_user"}}</dt>
|
||||
<dd>{{if .Mailer.User}}{{.Mailer.User}}{{else}}(empty){{end}}</dd>
|
||||
<div class="divider"></div>
|
||||
<dt class="tw-py-1 tw-flex tw-items-center">{{ctx.Locale.Tr "admin.config.send_test_mail"}}</dt>
|
||||
<dt class="flex-text-block tw-py-1">{{ctx.Locale.Tr "admin.config.send_test_mail"}}</dt>
|
||||
<dd class="tw-py-0">
|
||||
<form class="ui form ignore-dirty" action="{{AppSubUrl}}/-/admin/config/test_mail" method="post">
|
||||
<div class="ui tiny input">
|
||||
@ -254,7 +254,7 @@
|
||||
<dd>{{.CacheItemTTL}}</dd>
|
||||
{{end}}
|
||||
<div class="divider"></div>
|
||||
<dt class="tw-py-1 tw-flex tw-items-center">{{ctx.Locale.Tr "admin.config.cache_test"}}</dt>
|
||||
<dt class="flex-text-block tw-py-1">{{ctx.Locale.Tr "admin.config.cache_test"}}</dt>
|
||||
<dd class="tw-py-0">
|
||||
<form class="ui form ignore-dirty" action="{{AppSubUrl}}/-/admin/config/test_cache" method="post">
|
||||
<button class="ui tiny primary button">{{ctx.Locale.Tr "test"}}</button>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
{{if .Dirs}}
|
||||
<div class="ui aligned divided list">
|
||||
{{range $dirI, $dir := .Dirs}}
|
||||
<div class="item tw-flex tw-items-center">
|
||||
<div class="item flex-text-block">
|
||||
<span class="tw-flex-1"> {{svg "octicon-file-directory-fill"}} {{$dir}}</span>
|
||||
<div>
|
||||
<button class="ui button primary show-modal tw-p-2" data-modal="#adopt-unadopted-modal-{{$dirI}}">{{svg "octicon-plus"}} {{ctx.Locale.Tr "repo.adopt_preexisting_label"}}</button>
|
||||
|
||||
@ -151,8 +151,8 @@
|
||||
{{$activeStopwatch := and .PageGlobalData (call .PageGlobalData.GetActiveStopwatch)}}
|
||||
{{if $activeStopwatch}}
|
||||
<div class="active-stopwatch-popup tippy-target">
|
||||
<div class="tw-flex tw-items-center tw-gap-2 tw-p-3">
|
||||
<a class="stopwatch-link tw-flex tw-items-center tw-gap-2 muted" href="{{$activeStopwatch.IssueLink}}">
|
||||
<div class="flex-text-block tw-p-3">
|
||||
<a class="stopwatch-link flex-text-block muted" href="{{$activeStopwatch.IssueLink}}">
|
||||
{{svg "octicon-issue-opened" 16}}
|
||||
<span class="stopwatch-issue">{{$activeStopwatch.RepoSlug}}#{{$activeStopwatch.IssueIndex}}</span>
|
||||
</a>
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
{{if .Org.Visibility.IsLimited}}<span class="ui large basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</span>{{end}}
|
||||
{{if .Org.Visibility.IsPrivate}}<span class="ui large basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</span>{{end}}
|
||||
</span>
|
||||
<span class="tw-flex tw-items-center tw-gap-1 tw-ml-auto tw-text-16 tw-whitespace-nowrap">
|
||||
<span class="flex-text-inline tw-ml-auto tw-text-16 tw-whitespace-nowrap">
|
||||
{{if .EnableFeed}}
|
||||
<a class="ui basic label button tw-mr-0" href="{{.Org.HomeLink}}.rss" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">
|
||||
{{svg "octicon-rss" 24}}
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
{{if .NumMembers}}
|
||||
<h4 class="ui top attached header tw-flex">
|
||||
<strong class="tw-flex-1">{{ctx.Locale.Tr "org.members"}}</strong>
|
||||
<a class="tw-text-text-light tw-flex tw-items-center" href="{{.OrgLink}}/members"><span>{{.NumMembers}}</span> {{svg "octicon-chevron-right"}}</a>
|
||||
<a class="tw-text-text-light flex-text-inline" href="{{.OrgLink}}/members"><span>{{.NumMembers}}</span> {{svg "octicon-chevron-right"}}</a>
|
||||
</h4>
|
||||
<div class="ui attached segment members">
|
||||
{{$isMember := .IsOrganizationMember}}
|
||||
@ -63,7 +63,7 @@
|
||||
{{if .IsOrganizationMember}}
|
||||
<div class="ui top attached header tw-flex">
|
||||
<strong class="tw-flex-1">{{ctx.Locale.Tr "org.teams"}}</strong>
|
||||
<a class="tw-text-text-light tw-flex tw-items-center" href="{{.OrgLink}}/teams"><span>{{.Org.NumTeams}}</span> {{svg "octicon-chevron-right"}}</a>
|
||||
<a class="tw-text-text-light flex-text-inline" href="{{.OrgLink}}/teams"><span>{{.Org.NumTeams}}</span> {{svg "octicon-chevron-right"}}</a>
|
||||
</div>
|
||||
<div class="ui attached table segment teams">
|
||||
{{range .Teams}}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings labels")}}
|
||||
<div class="org-setting-content">
|
||||
<div class="tw-flex tw-items-center">
|
||||
<div class="flex-text-block">
|
||||
<div class="tw-flex-1">
|
||||
{{ctx.Locale.Tr "org.settings.labels_desc"}}
|
||||
</div>
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
{{end}}
|
||||
|
||||
<h4 class="ui top attached header tw-flex tw-items-center tw-justify-between">
|
||||
<div class="tw-flex tw-items-center">
|
||||
<div class="flex-text-block">
|
||||
{{ctx.Locale.Tr "repo.branches"}}
|
||||
</div>
|
||||
</h4>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<h4 class="ui top attached header commits-table tw-flex tw-items-center tw-justify-between">
|
||||
<div class="commits-table-left tw-flex tw-items-center">
|
||||
<div class="commits-table-left flex-text-block">
|
||||
{{if or .PageIsCommits (gt .CommitCount 0)}}
|
||||
{{.CommitCount}} {{ctx.Locale.Tr "repo.commits.commits"}}
|
||||
{{else if .IsNothingToCompare}}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{{$showFileTree := (and (not .DiffNotAvailable) (gt .DiffShortStat.NumFiles 1))}}
|
||||
<div>
|
||||
<div class="diff-detail-box">
|
||||
<div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-ml-0.5">
|
||||
<div class="flex-text-block tw-flex-wrap tw-ml-0.5">
|
||||
{{if $showFileTree}}
|
||||
<button class="diff-toggle-file-tree-button not-mobile btn interact-fg" data-show-text="{{ctx.Locale.Tr "repo.diff.show_file_tree"}}" data-hide-text="{{ctx.Locale.Tr "repo.diff.hide_file_tree"}}">
|
||||
{{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}}
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<div class="ui segment">
|
||||
<form class="ui form form-fetch-action" action="{{.Link}}/reviews/submit" method="post">
|
||||
<input type="hidden" name="commit_id" value="{{.AfterCommitID}}">
|
||||
<div class="field tw-flex tw-items-center">
|
||||
<div class="field flex-text-block">
|
||||
<div class="tw-flex-1">{{ctx.Locale.Tr "repo.diff.review.header"}}</div>
|
||||
<a class="muted close">{{svg "octicon-x" 16}}</a>
|
||||
</div>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
</div>
|
||||
<a class="issue-card-title muted issue-title tw-break-anywhere" href="{{.Link}}">{{.Title | ctx.RenderUtils.RenderIssueSimpleTitle}}</a>
|
||||
{{if and $.isPinnedIssueCard $.Page.IsRepoAdmin}}
|
||||
<a role="button" class="issue-card-unpin muted tw-flex tw-items-center" data-tooltip-content={{ctx.Locale.Tr "repo.issues.unpin"}} data-issue-id="{{.ID}}" data-unpin-url="{{$.Page.Link}}/unpin/{{.Index}}">
|
||||
<a role="button" class="issue-card-unpin muted flex-text-inline" data-tooltip-content={{ctx.Locale.Tr "repo.issues.unpin"}} data-issue-id="{{.ID}}" data-unpin-url="{{$.Page.Link}}/unpin/{{.Index}}">
|
||||
{{svg "octicon-x" 16}}
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<span><strong>{{.Name}}</strong></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="tw-p-2 tw-flex tw-items-center">
|
||||
<div class="flex-text-block tw-p-2">
|
||||
<span class="ui tw-text-text-light">{{.Size | FileSize}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
{{template "repo/migrate/helper" .}}
|
||||
<div class="ui cards migrate-entries">
|
||||
{{range .Services}}
|
||||
<a class="ui card migrate-entry tw-flex tw-items-center" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">
|
||||
<a class="ui card migrate-entry flex-text-block" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">
|
||||
{{if eq .Name "github"}}
|
||||
{{svg "octicon-mark-github" 184 "tw-p-4"}}
|
||||
{{else if eq .Name "gitlab"}}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div class="ui container">
|
||||
<div class="ui vertically grid head">
|
||||
<div class="column">
|
||||
<div class="ui header tw-flex tw-items-center tw-break-anywhere">
|
||||
<div class="ui header flex-text-block tw-break-anywhere">
|
||||
{{ctx.AvatarUtils.Avatar . 100}}
|
||||
<span class="tw-text-text-light"><a class="muted" href="{{.HomeLink}}">{{.DisplayName}}</a></span>
|
||||
<span class="org-visibility">
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<h4 class="ui top attached header">
|
||||
{{.CustomHeaderTitle}}
|
||||
<div class="ui right type dropdown">
|
||||
<div class="text tw-flex tw-items-center">
|
||||
<div class="text flex-text-inline">
|
||||
{{template "shared/webhook/icon" (dict "Size" 20 "HookType" .ctxData.HookType)}}
|
||||
{{ctx.Locale.Tr (print "repo.settings.web_hook_name_" .ctxData.HookType)}}
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user