From 1fb92e34657d1c839418fca179dde5c63988ca8d Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Fri, 27 Jun 2025 23:07:08 +0200 Subject: [PATCH 1/5] Flexbox branch list --- templates/repo/branch/list.tmpl | 191 +++++++++++++++++-------------- web_src/css/repo.css | 4 + web_src/css/shared/flex-list.css | 1 + 3 files changed, 107 insertions(+), 89 deletions(-) diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index fffe3a08cc4bf..c7800b3fe14b2 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -83,124 +83,137 @@
- - - {{range .Branches}} - - - - - {{/* FIXME: here and above, the tw-overflow-visible is not quite right */}} - - - {{end}} - -
- {{if .DBBranch.IsDeleted}} -
- {{.DBBranch.Name}} - -
-

{{ctx.Locale.Tr "repo.branch.deleted_by" .DBBranch.DeletedBy.Name}} {{DateUtils.TimeSince .DBBranch.DeletedUnix}}

- {{else}} -
- {{.DBBranch.Name}} +
+ {{range .Branches}} +
+
+
+ {{if .DBBranch.IsDeleted}} + {{.DBBranch.Name}} + + {{else}} + {{.DBBranch.Name}} {{if .IsProtected}} {{svg "octicon-shield-lock"}} {{end}} + {{ShortSha .DBBranch.CommitID}} {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DBBranch.CommitID)}} -
-

{{svg "octicon-git-commit" 16 "tw-mr-1"}}{{ShortSha .DBBranch.CommitID}} · {{ctx.RenderUtils.RenderCommitMessage .DBBranch.CommitMessage $.Repository}} · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DBBranch.CommitTime}}{{if .DBBranch.Pusher}}  {{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}}  {{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}

- {{end}} -
- {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}} -
-
-
{{.CommitsBehind}}
- {{/* old code bears 0/0.0 = NaN output, so it might output invalid "width: NaNpx", it just works and doesn't caues any problem. */}} -
-
-
-
{{.CommitsAhead}}
-
-
-
{{end}} -
+ +
+ {{if .DBBranch.IsDeleted}} + {{ctx.Locale.Tr "repo.branch.deleted_by" .DBBranch.DeletedBy.Name}} {{DateUtils.TimeSince .DBBranch.DeletedUnix}} + {{else}} + + {{ctx.RenderUtils.RenderCommitMessage .DBBranch.CommitMessage $.Repository}} · + {{if and .DBBranch.Pusher (gt .DBBranch.Pusher.ID 0)}} + + {{ctx.AvatarUtils.Avatar .DBBranch.Pusher 20}} + {{.DBBranch.Pusher.GetDisplayName}} + + {{end}} + {{DateUtils.TimeSince .DBBranch.CommitTime}} + {{end}} +
+
{{if not .LatestPullRequest}} {{if .IsIncluded}} - + {{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.branch.included"}} {{else if and (not .DBBranch.IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} - - + + {{if $.CanPull}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}} {{end}} {{else if and .LatestPullRequest.HasMerged .MergeMovedOn}} {{if and (not .DBBranch.IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} - - + + {{if $.CanPull}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}} {{end}} {{else}} {{if not .LatestPullRequest.IsSameRepo}}{{.LatestPullRequest.BaseRepo.FullName}}{{end}}#{{.LatestPullRequest.Issue.Index}} {{if .LatestPullRequest.HasMerged}} - {{svg "octicon-git-merge" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.pulls.merged"}} + {{svg "octicon-git-merge" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.pulls.merged"}} {{else if .LatestPullRequest.Issue.IsClosed}} - {{svg "octicon-git-pull-request-closed" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.closed_title"}} + {{svg "octicon-git-pull-request-closed" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.closed_title"}} {{else}} - {{svg "octicon-git-pull-request" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.open_title"}} + {{svg "octicon-git-pull-request" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.open_title"}} {{end}} {{end}} -
- {{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted)}} - - {{end}} - {{if $.EnableFeed}} - {{svg "octicon-rss"}} - {{end}} - {{if and (not .DBBranch.IsDeleted) (not $.DisableDownloadSourceArchives)}} - + +
+ {{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted)}} + - {{else}} - {{end}} - {{end}} -
+ {{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived) (not .IsProtected)}} + {{if .DBBranch.IsDeleted}} + + {{else}} + + {{end}} + {{end}} +
+ + {{end}} + {{template "base/paginate" .}} diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 1a05b68dd4ec2..6ee8ba5ef54a1 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -864,6 +864,10 @@ td .commit-summary { font-size: 14px; } +.repository.branches .commit-divergence { + min-width: 180px; +} + .repository.branches .commit-divergence .bar-group { position: relative; float: left; diff --git a/web_src/css/shared/flex-list.css b/web_src/css/shared/flex-list.css index 0f54779252292..384ca882a8b94 100644 --- a/web_src/css/shared/flex-list.css +++ b/web_src/css/shared/flex-list.css @@ -20,6 +20,7 @@ flex-grow: 1; flex-basis: 60%; /* avoid wrapping the "flex-item-trailing" too aggressively */ min-width: 0; /* make the "text truncate" work, otherwise the flex axis is not limited and the text just overflows */ + gap: .25rem; } .flex-item-header { From c7c3fddb32d62d353d13cf99d09d9c52190c6455 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Fri, 27 Jun 2025 23:56:32 +0200 Subject: [PATCH 2/5] Also fix default branch --- templates/repo/branch/list.tmpl | 199 +++++++++++++++++--------------- 1 file changed, 103 insertions(+), 96 deletions(-) diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index c7800b3fe14b2..c18733caf4229 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -15,58 +15,65 @@
- - - - - {{/* FIXME: here and below, the tw-overflow-visible is not quite right but it is still needed the moment: to show the important buttons when the width is narrow */}} - - - -
-
- {{.DefaultBranchBranch.DBBranch.Name}} - {{if .DefaultBranchBranch.IsProtected}} - {{svg "octicon-shield-lock"}} - {{end}} - - {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}} -
-

{{svg "octicon-git-commit" 16 "tw-mr-1"}}{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}} · {{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage .Repository}} · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime}}{{if .DefaultBranchBranch.DBBranch.Pusher}}  {{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}

-
- {{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}} - +
+
+
+
+ {{.DefaultBranchBranch.DBBranch.Name}} + {{if .DefaultBranchBranch.IsProtected}} + {{svg "octicon-shield-lock"}} {{end}} - {{if .EnableFeed}} - {{svg "octicon-rss"}} + + {{ShortSha .DefaultBranchBranch.DBBranch.CommitID}} + {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}} +
+
+ {{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage .Repository}} · + {{if and .DefaultBranchBranch.DBBranch.Pusher (gt .DefaultBranchBranch.DBBranch.Pusher.ID 0)}} + + {{ctx.AvatarUtils.Avatar .DefaultBranchBranch.DBBranch.Pusher 20}} + {{.DefaultBranchBranch.DBBranch.Pusher.GetDisplayName}} + {{end}} - {{if not $.DisableDownloadSourceArchives}} - +
+
+ {{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}} + + {{end}} + {{if .EnableFeed}} + {{svg "octicon-rss"}} + {{end}} + {{if not $.DisableDownloadSourceArchives}} +
+
+ {{end}} + {{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted) (not $.IsMirror)}} + + {{end}} + + + {{end}} @@ -163,53 +170,53 @@
- {{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted)}} - - {{end}} - {{if $.EnableFeed}} - - {{svg "octicon-rss"}} - - {{end}} - {{if and (not .DBBranch.IsDeleted) (not $.DisableDownloadSourceArchives)}} - - {{end}} - {{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted) (not $.IsMirror)}} - - {{end}} - {{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived) (not .IsProtected)}} - {{if .DBBranch.IsDeleted}} - - {{else}} - - {{end}} - {{end}} + {{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted)}} + + {{end}} + {{if $.EnableFeed}} + + {{svg "octicon-rss"}} + + {{end}} + {{if and (not .DBBranch.IsDeleted) (not $.DisableDownloadSourceArchives)}} + + {{end}} + {{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted) (not $.IsMirror)}} + + {{end}} + {{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived) (not .IsProtected)}} + {{if .DBBranch.IsDeleted}} + + {{else}} + + {{end}} + {{end}}
{{end}} From f5af46630370e1c269fdf0e15476ea2d4bff2188 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Sat, 28 Jun 2025 00:01:38 +0200 Subject: [PATCH 3/5] Remove obsolete css --- web_src/css/explore.css | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 web_src/css/explore.css diff --git a/web_src/css/explore.css b/web_src/css/explore.css deleted file mode 100644 index 968a103ce9368..0000000000000 --- a/web_src/css/explore.css +++ /dev/null @@ -1,13 +0,0 @@ -/* FIXME: need to refactor the repo branches list page and move these styles to proper place */ -.ui.repository.branches .info { - font-size: 12px; - color: var(--color-text-light); - display: flex; - white-space: pre; -} - -.ui.repository.branches .info .commit-message { - max-width: 72em; - overflow: hidden; - text-overflow: ellipsis; -} From d81d76e3c42026f27be6b986175ecfc637a334da Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Sat, 28 Jun 2025 00:01:38 +0200 Subject: [PATCH 4/5] Remove obsolete css --- web_src/css/explore.css | 13 ------------- web_src/css/index.css | 1 - 2 files changed, 14 deletions(-) delete mode 100644 web_src/css/explore.css diff --git a/web_src/css/explore.css b/web_src/css/explore.css deleted file mode 100644 index 968a103ce9368..0000000000000 --- a/web_src/css/explore.css +++ /dev/null @@ -1,13 +0,0 @@ -/* FIXME: need to refactor the repo branches list page and move these styles to proper place */ -.ui.repository.branches .info { - font-size: 12px; - color: var(--color-text-light); - display: flex; - white-space: pre; -} - -.ui.repository.branches .info .commit-message { - max-width: 72em; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/web_src/css/index.css b/web_src/css/index.css index 291cd04b2b95c..5c98e202bd24d 100644 --- a/web_src/css/index.css +++ b/web_src/css/index.css @@ -79,7 +79,6 @@ @import "./user.css"; @import "./dashboard.css"; @import "./admin.css"; -@import "./explore.css"; @import "./review.css"; @import "./actions.css"; From 422953b437e668fe90f34e42d8b64ce26f4d6427 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Sun, 29 Jun 2025 21:40:53 +0200 Subject: [PATCH 5/5] Fix tests --- templates/repo/branch/list.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index c18733caf4229..0331f124669a6 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -19,7 +19,7 @@
- {{.DefaultBranchBranch.DBBranch.Name}} + {{.DefaultBranchBranch.DBBranch.Name}} {{if .DefaultBranchBranch.IsProtected}} {{svg "octicon-shield-lock"}} {{end}} @@ -103,7 +103,7 @@ {{svg "octicon-copy" 14}} {{else}} - {{.DBBranch.Name}} + {{.DBBranch.Name}} {{if .IsProtected}} {{svg "octicon-shield-lock"}} {{end}}