From 76a1edf74f5f7fdf733b46fde12df644295e9fe8 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 22 Mar 2023 05:04:17 +0800 Subject: [PATCH] Decouple the issue-template code from comment_tab.tmpl (#23556) It would help #23290 The issue-template code is only useful for "new issue" or "new PR", so it could only be put in the `new_form.tmpl` --- templates/repo/issue/comment_tab.tmpl | 17 ----------------- templates/repo/issue/new_form.tmpl | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/templates/repo/issue/comment_tab.tmpl b/templates/repo/issue/comment_tab.tmpl index b04a3c6bb..b8e8d2d9a 100644 --- a/templates/repo/issue/comment_tab.tmpl +++ b/templates/repo/issue/comment_tab.tmpl @@ -1,19 +1,3 @@ -{{if .Fields}} - - {{range .Fields}} - {{if eq .Type "input"}} - {{template "repo/issue/fields/input" Dict "Context" $.Context "item" .}} - {{else if eq .Type "markdown"}} - {{template "repo/issue/fields/markdown" Dict "Context" $.Context "item" .}} - {{else if eq .Type "textarea"}} - {{template "repo/issue/fields/textarea" Dict "Context" $.Context "item" .}} - {{else if eq .Type "dropdown"}} - {{template "repo/issue/fields/dropdown" Dict "Context" $.Context "item" .}} - {{else if eq .Type "checkboxes"}} - {{template "repo/issue/fields/checkboxes" Dict "Context" $.Context "item" .}} - {{end}} - {{end}} -{{else}} -{{end}} {{if .IsAttachmentEnabled}}
{{template "repo/upload" .}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 4945203ca..f6ef8e675 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -16,7 +16,29 @@
{{.locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}
{{end}}
- {{template "repo/issue/comment_tab" .}} + {{if .Fields}} + + {{range .Fields}} + {{if eq .Type "input"}} + {{template "repo/issue/fields/input" Dict "Context" $.Context "item" .}} + {{else if eq .Type "markdown"}} + {{template "repo/issue/fields/markdown" Dict "Context" $.Context "item" .}} + {{else if eq .Type "textarea"}} + {{template "repo/issue/fields/textarea" Dict "Context" $.Context "item" .}} + {{else if eq .Type "dropdown"}} + {{template "repo/issue/fields/dropdown" Dict "Context" $.Context "item" .}} + {{else if eq .Type "checkboxes"}} + {{template "repo/issue/fields/checkboxes" Dict "Context" $.Context "item" .}} + {{end}} + {{end}} + {{if .IsAttachmentEnabled}} +
+ {{template "repo/upload" .}} +
+ {{end}} + {{else}} + {{template "repo/issue/comment_tab" .}} + {{end}}