Skip to content

Commit a6a4a50

Browse files
committed
fine tune
1 parent 465f42e commit a6a4a50

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

options/locale/locale_en-US.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2769,10 +2769,8 @@ branch.new_branch_from = Create new branch from "%s"
27692769
branch.renamed = Branch %s was renamed to %s.
27702770
branch.rename_default_or_protected_branch_error = Only admins can rename default or protected branches.
27712771
branch.rename_protected_branch_failed = This branch is protected by glob-based protection rules.
2772-
branch.commits_ahead_1 = %d commit ahead
2773-
branch.commits_ahead_n = %d commits ahead
2774-
branch.commits_behind_1 = %d commit behind %s
2775-
branch.commits_behind_n = %d commits behind %s
2772+
branch.commits_divergence_from = Commits divergence: %[1]d behind and %[2]d ahead %[3]s
2773+
branch.commits_no_divergence = The same as branch %[1]s
27762774
27772775
tag.create_tag = Create tag %s
27782776
tag.create_tag_operation = Create tag

templates/repo/branch/list.tmpl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,14 @@
107107
{{end}}
108108
</td>
109109
<td class="two wide ui">
110-
{{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}}
111-
<div class="commit-divergence" data-tooltip-content="{{ctx.Locale.TrN .CommitsBehind "repo.branch.commits_behind_1" "repo.branch.commits_behind_n" .CommitsBehind $.DefaultBranchBranch.DBBranch.Name}}, {{ctx.Locale.TrN .CommitsAhead "repo.branch.commits_ahead_1" "repo.branch.commits_ahead_n" .CommitsAhead}}">
110+
{{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}}
111+
{{$tooltipDivergence := ""}}
112+
{{if or .CommitsBehind .CommitsAhead}}
113+
{{$tooltipDivergence = ctx.Locale.Tr "repo.branch.commits_divergence_from" .CommitsBehind .CommitsAhead $.DefaultBranchBranch.DBBranch.Name}}
114+
{{else}}
115+
{{$tooltipDivergence = ctx.Locale.Tr "repo.branch.commits_no_divergence" $.DefaultBranchBranch.DBBranch.Name}}
116+
{{end}}
117+
<div class="commit-divergence" data-tooltip-content="{{$tooltipDivergence}}">
112118
<div class="bar-group">
113119
<div class="count count-behind">{{.CommitsBehind}}</div>
114120
{{/* old code bears 0/0.0 = NaN output, so it might output invalid "width: NaNpx", it just works and doesn't caues any problem. */}}
@@ -119,7 +125,7 @@
119125
<div class="bar bar-ahead" style="width: {{Eval 100 "*" .CommitsAhead "/" "(" .CommitsBehind "+" .CommitsAhead "+" 0.0 ")"}}%"></div>
120126
</div>
121127
</div>
122-
{{end}}
128+
{{end}}
123129
</td>
124130
<td class="two wide tw-text-right">
125131
{{if not .LatestPullRequest}}

0 commit comments

Comments
 (0)