refactor: extract to subtemplate

This commit is contained in:
Tim-Niclas Oelschläger 2024-02-09 17:55:42 +01:00 committed by Lunny Xiao
parent aa061b409f
commit 925ac870dc
3 changed files with 23 additions and 26 deletions

View File

@ -1685,7 +1685,9 @@ issues.dependency.issue_close_blocked = You need to close all issues blocking th
issues.dependency.issue_batch_close_blocked = "Cannot batch close issues that you choose, because issue #%d still has open dependencies"
issues.dependency.pr_close_blocked = You need to close all issues blocking this pull request before you can merge it.
issues.dependency.blocks_short = Blocks
issues.dependency.blocks_following = Blocks:
issues.dependency.blocked_by_short = Depends on
issues.dependency.blocked_by_following = Depends on:
issues.dependency.remove_header = Remove Dependency
issues.dependency.issue_remove_text = This will remove the dependency from this issue. Continue?
issues.dependency.pr_remove_text = This will remove the dependency from this pull request. Continue?

View File

@ -0,0 +1,13 @@
{{if and .DependenciesMap (index .DependenciesMap .ID)}}
<div class="flex-text-inline gt-gap-0">
<strong class="gt-mr-2">{{.Title}}</strong>
{{$first := true}}
{{range (index .DependenciesMap .ID)}}
{{if not $first}}<span class="gt-mr-2">,</span>{{end}}
{{$first = false}}
<a href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}">
#{{.Issue.Index}}
</a>
{{end}}
</div>
{{end}}

View File

@ -118,32 +118,14 @@
</span>
</span>
{{end}}
{{if and $.BlockingDependenciesMap (index $.BlockingDependenciesMap .ID)}}
<div class="flex-text-inline gt-gap-0">
<strong class="gt-mr-2">{{ctx.Locale.Tr "repo.issues.dependency.blocks_short"}}:</strong>
{{ $first := true }}
{{range (index $.BlockingDependenciesMap .ID)}}
{{if not $first}}<span class="gt-mr-2">, </span>{{end}}
{{ $first = false }}
<a href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}">
#{{.Issue.Index}}
</a>
{{end}}
</div>
{{end}}
{{if and $.BlockedByDependenciesMap (index $.BlockedByDependenciesMap .ID)}}
<div class="flex-text-inline gt-gap-0">
<strong class="gt-mr-2">{{ctx.Locale.Tr "repo.issues.dependency.blocked_by_short"}}:</strong>
{{ $first := true }}
{{range (index $.BlockedByDependenciesMap .ID)}}
{{if not $first}}<span class="gt-mr-2">, </span>{{end}}
{{ $first = false }}
<a href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}">
#{{.Issue.Index}}
</a>
{{end}}
</div>
{{end}}
{{template "shared/issue_dependency" (dict
"ID" .ID
"DependenciesMap" $.BlockingDependenciesMap
"Title" (ctx.Locale.Tr "repo.issues.dependency.blocks_following"))}}
{{template "shared/issue_dependency" (dict
"ID" .ID
"DependenciesMap" $.BlockedByDependenciesMap
"Title" (ctx.Locale.Tr "repo.issues.dependency.blocked_by_following"))}}
{{if .IsPull}}
{{$approveOfficial := call $approvalCounts .ID "approve"}}
{{$rejectOfficial := call $approvalCounts .ID "reject"}}