diff options
author | John Olheiser <john.olheiser@gmail.com> | 2020-09-11 09:48:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-11 10:48:39 -0400 |
commit | 26c4a049da178993e5ccddcb50e7edc70a6bde5d (patch) | |
tree | 494106117720ff3ad5f9e77a380c9397c3cfe10b /templates | |
parent | dd1a651b5895cfdb8a141a56aa824ed4d082c41a (diff) | |
download | gitea-26c4a049da178993e5ccddcb50e7edc70a6bde5d.tar.gz gitea-26c4a049da178993e5ccddcb50e7edc70a6bde5d.zip |
Issue templates directory (#11450)
* Issue templates
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Add some comments, appease the linter
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Add docs and re-use dir candidates
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Add default labels to issue templates
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Generate swagger
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Suggested changes
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Update issue.go
* Suggestions
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Extract metadata from legacy if possible
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/issue/choose.tmpl | 25 | ||||
-rw-r--r-- | templates/repo/issue/list.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/milestone_issues.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view.tmpl | 2 | ||||
-rw-r--r-- | templates/swagger/v1_json.tmpl | 76 |
6 files changed, 105 insertions, 4 deletions
diff --git a/templates/repo/issue/choose.tmpl b/templates/repo/issue/choose.tmpl new file mode 100644 index 0000000000..57f69f8c14 --- /dev/null +++ b/templates/repo/issue/choose.tmpl @@ -0,0 +1,25 @@ +{{template "base/head" .}} +<div class="repository new issue"> + {{template "repo/header" .}} + <div class="ui container"> + <div class="navbar"> + {{template "repo/issue/navbar" .}} + </div> + <div class="ui divider"></div> + {{range .IssueTemplates}} + <div class="ui attached segment"> + <div class="ui two column grid"> + <div class="column left aligned"> + <strong>{{.Name | RenderEmojiPlain}}</strong> + <br/>{{.About | RenderEmojiPlain}} + </div> + <div class="column right aligned"> + <a href="{{$.RepoLink}}/issues/new?template={{.FileName}}{{if $.milestone}}&milestone={{$.milestone}}{{end}}" class="ui green button">{{$.i18n.Tr "repo.issues.choose.get_started"}}</a> + </div> + </div> + </div> + {{end}} + <a href="{{.RepoLink}}/issues/new{{if .milestone}}?milestone={{.milestone}}{{end}}">{{.i18n.Tr "repo.issues.choose.blank"}}</a> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 99b298be4d..36eb092202 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -12,7 +12,7 @@ {{if not .Repository.IsArchived}} <div class="column right aligned"> {{if .PageIsIssueList}} - <a class="ui green button" href="{{.RepoLink}}/issues/new">{{.i18n.Tr "repo.issues.new"}}</a> + <a class="ui green button" href="{{.RepoLink}}/issues/new{{if .NewIssueChooseTemplate}}/choose{{end}}">{{.i18n.Tr "repo.issues.new"}}</a> {{else}} <a class="ui green button {{if not .PullRequestCtx.Allowed}}disabled{{end}}" href="{{if .PullRequestCtx.Allowed}}{{.Repository.Link}}/compare/{{.Repository.DefaultBranch | EscapePound}}...{{if ne .Repository.Owner.Name .PullRequestCtx.BaseRepo.Owner.Name}}{{.Repository.Owner.Name}}:{{end}}{{.Repository.DefaultBranch | EscapePound}}{{end}}">{{.i18n.Tr "repo.pulls.new"}}</a> {{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 8aecf8d773..7a55eaa01d 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -16,7 +16,7 @@ {{if or .CanWriteIssues .CanWritePulls}} <a class="ui grey button" href="{{.RepoLink}}/milestones/{{.MilestoneID}}/edit">{{.i18n.Tr "repo.milestones.edit"}}</a> {{end}} - <a class="ui green button" href="{{.RepoLink}}/issues/new?milestone={{.MilestoneID}}">{{.i18n.Tr "repo.issues.new"}}</a> + <a class="ui green button" href="{{.RepoLink}}/issues/new{{if .NewIssueChooseTemplate}}/choose{{end}}?milestone={{.MilestoneID}}">{{.i18n.Tr "repo.issues.new"}}</a> </div> {{end}} </div> diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 8d7b3902e4..058ade5bce 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -13,7 +13,7 @@ </a> <div class="ui segment content"> <div class="field"> - <input name="title" id="issue_title" placeholder="{{.i18n.Tr "repo.milestones.title"}}" value="{{.title}}" tabindex="3" autofocus required maxlength="255"> + <input name="title" id="issue_title" placeholder="{{.i18n.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" tabindex="3" autofocus required maxlength="255"> {{if .PageIsComparePull}} <div class="title_wip_desc" data-wip-prefixes="{{Json .PullRequestWorkInProgressPrefixes}}">{{.i18n.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}</div> {{end}} diff --git a/templates/repo/issue/view.tmpl b/templates/repo/issue/view.tmpl index 6abf84cab9..c23bac3c6a 100644 --- a/templates/repo/issue/view.tmpl +++ b/templates/repo/issue/view.tmpl @@ -9,7 +9,7 @@ {{if not .Repository.IsArchived}} <div class="column right aligned"> {{if .PageIsIssueList}} - <a class="ui green button" href="{{.RepoLink}}/issues/new">{{.i18n.Tr "repo.issues.new"}}</a> + <a class="ui green button" href="{{.RepoLink}}/issues/new{{if .NewIssueChooseTemplate}}/choose{{end}}">{{.i18n.Tr "repo.issues.new"}}</a> {{else}} <a class="ui green button {{if not .PullRequestCtx.Allowed}}disabled{{end}}" href="{{.RepoLink}}/compare/{{.BranchName | EscapePound}}...{{.PullRequestCtx.HeadInfo | EscapePound}}">{{.i18n.Tr "repo.pulls.new"}}</a> {{end}} diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index ac65b3ce17..a5840f2bab 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -3852,6 +3852,39 @@ } } }, + "/repos/{owner}/{repo}/issue_templates": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get available issue templates for a repository", + "operationId": "repoGetIssueTemplates", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/IssueTemplates" + } + } + } + }, "/repos/{owner}/{repo}/issues": { "get": { "produces": [ @@ -13439,6 +13472,40 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "IssueTemplate": { + "description": "IssueTemplate represents an issue template for a repository", + "type": "object", + "properties": { + "about": { + "type": "string", + "x-go-name": "About" + }, + "content": { + "type": "string", + "x-go-name": "Content" + }, + "file_name": { + "type": "string", + "x-go-name": "FileName" + }, + "labels": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Labels" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "title": { + "type": "string", + "x-go-name": "Title" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "Label": { "description": "Label a label to an issue or a pr", "type": "object", @@ -15480,6 +15547,15 @@ } } }, + "IssueTemplates": { + "description": "IssueTemplates", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/IssueTemplate" + } + } + }, "Label": { "description": "Label", "schema": { |