mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-01-05 23:30:02 +01:00
Merge pull request #1592 from t-tsutsumi/pr/fix-conditional-expression-default-branch
Fix conditional expression for determining whether it is default branch
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
</span>
|
||||
</td>
|
||||
<td class="branch-a-b-count">
|
||||
@if(branch.mergeInfo.isEmpty){
|
||||
@if(repository.repository.defaultBranch == branch.name){
|
||||
<span class="badge">Default</span>
|
||||
} else {
|
||||
@branch.mergeInfo.map{ info =>
|
||||
@@ -38,47 +38,49 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="branch-action">
|
||||
@branch.mergeInfo.map{ info =>
|
||||
@prs.map{ case (pull, issue) =>
|
||||
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title">#@issue.issueId</a>
|
||||
@if(issue.closed) {
|
||||
@if(info.isMerged){
|
||||
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-info">Merged</a>
|
||||
} else {
|
||||
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-important">Closed</a>
|
||||
@if(repository.repository.defaultBranch != branch.name){
|
||||
@branch.mergeInfo.map{ info =>
|
||||
@prs.map{ case (pull, issue) =>
|
||||
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title">#@issue.issueId</a>
|
||||
@if(issue.closed) {
|
||||
@if(info.isMerged){
|
||||
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-info">Merged</a>
|
||||
} else {
|
||||
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-important">Closed</a>
|
||||
}
|
||||
} else {
|
||||
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-success">Open</a>
|
||||
}
|
||||
}.getOrElse{
|
||||
@if(context.loginAccount.isDefined){
|
||||
<a href="@helpers.url(repository)/compare/@{repository.repository.parentUserName.map { parent =>
|
||||
helpers.urlEncode(parent) + ":" + helpers.encodeRefName(repository.repository.defaultBranch)
|
||||
}.getOrElse {
|
||||
helpers.encodeRefName(repository.repository.defaultBranch)
|
||||
}}...@{helpers.encodeRefName(branch.name)}?expand=1" class="btn btn-default">New Pull request</a>
|
||||
} else {
|
||||
<a href="@helpers.url(repository)/compare/@{repository.repository.parentUserName.map { parent =>
|
||||
helpers.urlEncode(parent) + ":" + helpers.encodeRefName(repository.repository.defaultBranch)
|
||||
}.getOrElse {
|
||||
helpers.encodeRefName(repository.repository.defaultBranch)
|
||||
}}...@{helpers.encodeRefName(branch.name)}" class="btn btn-default">Compare</a>
|
||||
}
|
||||
}
|
||||
} else {
|
||||
<a href="@helpers.url(repository)/pull/@issue.issueId" title="@issue.title" class="label label-success">Open</a>
|
||||
}
|
||||
}.getOrElse{
|
||||
@if(context.loginAccount.isDefined){
|
||||
<a href="@helpers.url(repository)/compare/@{repository.repository.parentUserName.map { parent =>
|
||||
helpers.urlEncode(parent) + ":" + helpers.encodeRefName(repository.repository.defaultBranch)
|
||||
}.getOrElse {
|
||||
helpers.encodeRefName(repository.repository.defaultBranch)
|
||||
}}...@{helpers.encodeRefName(branch.name)}?expand=1" class="btn btn-default">New Pull request</a>
|
||||
} else {
|
||||
<a href="@helpers.url(repository)/compare/@{repository.repository.parentUserName.map { parent =>
|
||||
helpers.urlEncode(parent) + ":" + helpers.encodeRefName(repository.repository.defaultBranch)
|
||||
}.getOrElse {
|
||||
helpers.encodeRefName(repository.repository.defaultBranch)
|
||||
}}...@{helpers.encodeRefName(branch.name)}" class="btn btn-default">Compare</a>
|
||||
}
|
||||
}
|
||||
@if(hasWritePermission){
|
||||
<span style="margin-left: 8px;">
|
||||
@if(prs.map(!_._2.closed).getOrElse(false)){
|
||||
<a class="disabled" data-toggle="tooltip" title="You can’t delete this branch because it has an open pull request"><i class="octicon octicon-trashcan"></i></a>
|
||||
} else {
|
||||
@if(isProtected){
|
||||
<a class="disabled" data-toggle="tooltip" title="You can’t delete a protected branch."><i class="octicon octicon-trashcan"></i></a>
|
||||
} else {
|
||||
<a href="@helpers.url(repository)/delete/@helpers.encodeRefName(branch.name)" class="delete-branch" data-name="@branch.name" @if(info.isMerged){ data-toggle="tooltip" title="this branch is merged" }><i class="octicon octicon-trashcan @if(info.isMerged){warning} else {danger}"></i></a>
|
||||
@if(hasWritePermission){
|
||||
<span style="margin-left: 8px;">
|
||||
@if(prs.map(!_._2.closed).getOrElse(false)){
|
||||
<a class="disabled" data-toggle="tooltip" title="You can’t delete this branch because it has an open pull request"><i class="octicon octicon-trashcan"></i></a>
|
||||
} else {
|
||||
@if(isProtected){
|
||||
<a class="disabled" data-toggle="tooltip" title="You can’t delete a protected branch."><i class="octicon octicon-trashcan"></i></a>
|
||||
} else {
|
||||
<a href="@helpers.url(repository)/delete/@helpers.encodeRefName(branch.name)" class="delete-branch" data-name="@branch.name" @if(info.isMerged){ data-toggle="tooltip" title="this branch is merged" }><i class="octicon octicon-trashcan @if(info.isMerged){warning} else {danger}"></i></a>
|
||||
}
|
||||
}
|
||||
</span>
|
||||
}
|
||||
}
|
||||
</span>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user