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
This commit is contained in:
wxiaoguang
2026-05-03 00:10:52 +08:00
committed by GitHub
parent f049668c21
commit 134e86c78c
54 changed files with 560 additions and 557 deletions
+38 -52
View File
@@ -1,61 +1,47 @@
<div class="repo-home-sidebar-bottom">
<div class="flex-list">
{{if .LatestRelease}}
<div class="flex-item">
<div class="flex-item-main">
<div class="flex-item-title">
<a class="item muted" href="{{.RepoLink}}/releases">
{{ctx.Locale.Tr "repo.releases"}}
</a>
<span class="ui small label">{{.NumReleases}}</span>
</div>
<div class="flex-item">
<div class="flex-item-leading">
<div class="tw-mt-1">{{svg "octicon-tag" 16}}</div>
</div>
<div class="flex-item-main">
<div class="flex-item-header">
<div class="flex-item-title tw-gap-2">
<a class="gt-ellipsis muted" href="{{.LatestRelease.Link}}" title="{{.LatestRelease.Title}}">{{.LatestRelease.Title}}</a>
{{template "repo/release/label" (dict "Release" .LatestRelease "IsLatest" true)}}
</div>
</div>
<div class="flex-item-body">
<span class="time">{{DateUtils.TimeSince .LatestRelease.CreatedUnix}}</span>
</div>
</div>
<div class="repo-home-sidebar-bottom flex-relaxed-list">
{{if .LatestRelease}}
<div class="divider"></div>
<div class="repo-home-sidebar-header">
<a class="item muted" href="{{.RepoLink}}/releases">
{{ctx.Locale.Tr "repo.releases"}}
</a>
<span class="ui small label">{{.NumReleases}}</span>
</div>
<div class="flex-relaxed-list">
<div class="flex-text-block">
<div>{{svg "octicon-tag"}}</div>
<a class="gt-ellipsis muted" href="{{.LatestRelease.Link}}" title="{{.LatestRelease.Title}}">{{.LatestRelease.Title}}</a>
<div class="tw-shrink-0">
{{template "repo/release/label" (dict "Release" .LatestRelease "IsLatest" true)}}
</div>
</div>
<div class="tw-ml-[24px]">{{DateUtils.TimeSince .LatestRelease.CreatedUnix}}</div>
</div>
{{end}}
{{end}}
{{if and (not .IsEmptyRepo) .LanguageStats}}
<div class="flex-item">
<div class="flex-item-main">
<div class="flex-item-title">
{{ctx.Locale.Tr "repo.repo_lang"}}
</div>
{{if and (not .IsEmptyRepo) .LanguageStats}}
<div class="divider"></div>
<div class="repo-home-sidebar-header">
{{ctx.Locale.Tr "repo.repo_lang"}}
</div>
<div class="flex-item-body">
<div class="language-stats">
{{range .LanguageStats}}
<div class="bar" style="width: {{.Percentage}}%; background-color: {{.Color}}" data-tooltip-placement="top" data-tooltip-content={{.Language}} data-tooltip-follow-cursor="horizontal"></div>
{{end}}
</div>
<div class="language-stats-details">
{{range .LanguageStats}}
<div class="item">
<i class="color-icon" style="background-color: {{.Color}}"></i>
<span class="tw-font-semibold">
{{Iif (eq .Language "other") (ctx.Locale.Tr "repo.language_other") .Language}}
</span>
{{.Percentage}}%
</div>
{{end}}
</div>
<div>
<div class="language-stats">
{{range .LanguageStats}}
<div class="bar" style="width: {{.Percentage}}%; background-color: {{.Color}}" data-tooltip-placement="top" data-tooltip-content="{{.Language}}" data-tooltip-follow-cursor="horizontal"></div>
{{end}}
</div>
<div class="language-stats-details">
{{range .LanguageStats}}
<div class="item">
<i class="color-icon" style="background-color: {{.Color}}"></i>
<strong class="tw-font-semibold">
{{Iif (eq .Language "other") (ctx.Locale.Tr "repo.language_other") .Language}}
</strong>
{{.Percentage}}%
</div>
{{end}}
</div>
</div>
{{end}}
</div>
{{end}}
</div>