Skip to content

Commit 76a1edf

Browse files
authored
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`
1 parent 9b01908 commit 76a1edf

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

templates/repo/issue/comment_tab.tmpl

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
{{if .Fields}}
2-
<input type="hidden" name="template-file" value="{{.TemplateFile}}">
3-
{{range .Fields}}
4-
{{if eq .Type "input"}}
5-
{{template "repo/issue/fields/input" Dict "Context" $.Context "item" .}}
6-
{{else if eq .Type "markdown"}}
7-
{{template "repo/issue/fields/markdown" Dict "Context" $.Context "item" .}}
8-
{{else if eq .Type "textarea"}}
9-
{{template "repo/issue/fields/textarea" Dict "Context" $.Context "item" .}}
10-
{{else if eq .Type "dropdown"}}
11-
{{template "repo/issue/fields/dropdown" Dict "Context" $.Context "item" .}}
12-
{{else if eq .Type "checkboxes"}}
13-
{{template "repo/issue/fields/checkboxes" Dict "Context" $.Context "item" .}}
14-
{{end}}
15-
{{end}}
16-
{{else}}
171
<div class="ui top tabular menu" data-write="write" data-preview="preview">
182
<a class="active item" data-tab="write">{{.locale.Tr "write"}}</a>
193
<a class="item" data-tab="preview" data-url="{{.Repository.Link}}/markdown" data-context="{{.RepoLink}}">{{.locale.Tr "preview"}}</a>
@@ -28,7 +12,6 @@
2812
{{.locale.Tr "loading"}}
2913
</div>
3014
</div>
31-
{{end}}
3215
{{if .IsAttachmentEnabled}}
3316
<div class="field">
3417
{{template "repo/upload" .}}

templates/repo/issue/new_form.tmpl

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,29 @@
1616
<div class="title_wip_desc" data-wip-prefixes="{{Json .PullRequestWorkInProgressPrefixes}}">{{.locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}</div>
1717
{{end}}
1818
</div>
19-
{{template "repo/issue/comment_tab" .}}
19+
{{if .Fields}}
20+
<input type="hidden" name="template-file" value="{{.TemplateFile}}">
21+
{{range .Fields}}
22+
{{if eq .Type "input"}}
23+
{{template "repo/issue/fields/input" Dict "Context" $.Context "item" .}}
24+
{{else if eq .Type "markdown"}}
25+
{{template "repo/issue/fields/markdown" Dict "Context" $.Context "item" .}}
26+
{{else if eq .Type "textarea"}}
27+
{{template "repo/issue/fields/textarea" Dict "Context" $.Context "item" .}}
28+
{{else if eq .Type "dropdown"}}
29+
{{template "repo/issue/fields/dropdown" Dict "Context" $.Context "item" .}}
30+
{{else if eq .Type "checkboxes"}}
31+
{{template "repo/issue/fields/checkboxes" Dict "Context" $.Context "item" .}}
32+
{{end}}
33+
{{end}}
34+
{{if .IsAttachmentEnabled}}
35+
<div class="field">
36+
{{template "repo/upload" .}}
37+
</div>
38+
{{end}}
39+
{{else}}
40+
{{template "repo/issue/comment_tab" .}}
41+
{{end}}
2042
<div class="text right">
2143
<button class="ui green button loading-button" tabindex="6">
2244
{{if .PageIsComparePull}}

0 commit comments

Comments
 (0)