mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-21 23:02:41 +01:00
[Branch View] Add Included TAG (#8449)
* included message * add property IsIncluded * Add Orange Lable
This commit is contained in:
parent
0be992a1e2
commit
733c898a90
3 changed files with 11 additions and 1 deletions
|
@ -1453,6 +1453,8 @@ branch.restore_failed = Failed to restore branch '%s'.
|
||||||
branch.protected_deletion_failed = Branch '%s' is protected. It cannot be deleted.
|
branch.protected_deletion_failed = Branch '%s' is protected. It cannot be deleted.
|
||||||
branch.restore = Restore Branch '%s'
|
branch.restore = Restore Branch '%s'
|
||||||
branch.download = Download Branch '%s'
|
branch.download = Download Branch '%s'
|
||||||
|
branch.included_desc = This branch is part of the default branch
|
||||||
|
branch.included = Included
|
||||||
|
|
||||||
topic.manage_topics = Manage Topics
|
topic.manage_topics = Manage Topics
|
||||||
topic.done = Done
|
topic.done = Done
|
||||||
|
|
|
@ -28,6 +28,7 @@ type Branch struct {
|
||||||
Commit *git.Commit
|
Commit *git.Commit
|
||||||
IsProtected bool
|
IsProtected bool
|
||||||
IsDeleted bool
|
IsDeleted bool
|
||||||
|
IsIncluded bool
|
||||||
DeletedBranch *models.DeletedBranch
|
DeletedBranch *models.DeletedBranch
|
||||||
CommitsAhead int
|
CommitsAhead int
|
||||||
CommitsBehind int
|
CommitsBehind int
|
||||||
|
@ -203,10 +204,13 @@ func loadBranches(ctx *context.Context) []*Branch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isIncluded := divergence.Ahead == 0 && ctx.Repo.Repository.DefaultBranch != branchName
|
||||||
|
|
||||||
branches[i] = &Branch{
|
branches[i] = &Branch{
|
||||||
Name: branchName,
|
Name: branchName,
|
||||||
Commit: commit,
|
Commit: commit,
|
||||||
IsProtected: isProtected,
|
IsProtected: isProtected,
|
||||||
|
IsIncluded: isIncluded,
|
||||||
CommitsAhead: divergence.Ahead,
|
CommitsAhead: divergence.Ahead,
|
||||||
CommitsBehind: divergence.Behind,
|
CommitsBehind: divergence.Behind,
|
||||||
LatestPullRequest: pr,
|
LatestPullRequest: pr,
|
||||||
|
|
|
@ -75,7 +75,11 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="two wide right aligned">
|
<td class="two wide right aligned">
|
||||||
{{if not .LatestPullRequest}}
|
{{if not .LatestPullRequest}}
|
||||||
{{if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}}
|
{{if .IsIncluded}}
|
||||||
|
<a class="ui poping up orange small label" data-content="{{$.i18n.Tr "repo.branch.included_desc"}}" data-variation="tiny inverted" data-position="top right">
|
||||||
|
<i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.branch.included"}}
|
||||||
|
</a>
|
||||||
|
{{else if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}}
|
||||||
<a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}">
|
<a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}">
|
||||||
<button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button>
|
<button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue