diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 0997239a55..532fc7989e 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -165,6 +165,7 @@ func NewFuncMap() template.FuncMap { "RenderMarkdownToHtml": RenderMarkdownToHtml, "RenderLabel": RenderLabel, "RenderLabels": RenderLabels, + "RenderDependencies": RenderDependencies, // ----------------------------------------------------------------- // misc diff --git a/modules/templates/util_render.go b/modules/templates/util_render.go index cdff31698c..ead41faa32 100644 --- a/modules/templates/util_render.go +++ b/modules/templates/util_render.go @@ -224,3 +224,21 @@ func RenderLabels(ctx context.Context, labels []*issues_model.Label, repoLink st htmlCode += "" return template.HTML(htmlCode) } + +func RenderDependencies(ctx context.Context, dependencies []*issues_model.DependencyInfo) template.HTML { + if dependencies == nil || len(dependencies) < 1 { + return "" + } + + htmlCode := "" + + for index, dependency := range dependencies { + if index != 0 { + htmlCode += `,` + } + htmlCode += fmt.Sprintf(`#%d`, + dependency.Issue.Link(), dependency.Issue.Index, RenderEmoji(ctx, dependency.Issue.Title), dependency.Issue.Index) + } + + return template.HTML(htmlCode) +} diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 9df6bf658e..ad7e68bbc1 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1685,9 +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.blocks_following = Blocks: %s issues.dependency.blocked_by_short = Depends on -issues.dependency.blocked_by_following = Depends on: +issues.dependency.blocked_by_following = Depends on: %s 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? diff --git a/templates/shared/issue_dependency.tmpl b/templates/shared/issue_dependency.tmpl index 09d3acd27f..481cba8229 100644 --- a/templates/shared/issue_dependency.tmpl +++ b/templates/shared/issue_dependency.tmpl @@ -1,13 +1,5 @@ -{{if and .DependenciesMap (index .DependenciesMap .ID)}} -