aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkekero <LoveEevee@users.noreply.github.com>2019-01-28 18:23:59 +0300
committertechknowlogick <matti@mdranta.net>2019-01-28 10:23:59 -0500
commit3568d426fece2338d6f1bedd1fd6ffe8677fc8fe (patch)
tree8d4867695111b0df44376c93ea8d6962c9cb0b72
parent7461c5a75f7363aecc57b9a2c1358fb7cf92c27e (diff)
downloadgitea-3568d426fece2338d6f1bedd1fd6ffe8677fc8fe.tar.gz
gitea-3568d426fece2338d6f1bedd1fd6ffe8677fc8fe.zip
New Issue ?body= query (#5851)
* New Issue ?body= query * Override issue template with body query * Add documentation for issue body query
-rw-r--r--docs/content/doc/usage/issue-pull-request-templates.en-us.md5
-rw-r--r--routers/repo/issue.go2
-rw-r--r--templates/repo/issue/comment_tab.tmpl2
3 files changed, 7 insertions, 2 deletions
diff --git a/docs/content/doc/usage/issue-pull-request-templates.en-us.md b/docs/content/doc/usage/issue-pull-request-templates.en-us.md
index 5eaf0db0c7..e7582f3208 100644
--- a/docs/content/doc/usage/issue-pull-request-templates.en-us.md
+++ b/docs/content/doc/usage/issue-pull-request-templates.en-us.md
@@ -19,7 +19,7 @@ For some projects there are a standard list of questions that users need to be a
for creating an issue, or adding a pull request. Gitea supports adding templates to the
main branch of the repository so that they can autopopulate the form when users are
creating issues, and pull requests. This will cut down on the initial back and forth
-of getting some clarifiying details.
+of getting some clarifying details.
Possible file names for issue templates:
@@ -39,3 +39,6 @@ Possible file names for PR templates:
* .gitea/pull_request_template.md
* .github/PULL_REQUEST_TEMPLATE.md
* .github/pull_request_template.md
+
+
+Additionally, the New Issue page URL can be suffixed with `?body=Issue+Text` and the form will be populated with that string. This string will be used instead of the template if there is one.
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 588e727ca4..bcc648900a 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -374,6 +374,8 @@ func NewIssue(ctx *context.Context) {
ctx.Data["RequireSimpleMDE"] = true
ctx.Data["RequireTribute"] = true
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
+ body := ctx.Query("body")
+ ctx.Data["BodyQuery"] = body
milestoneID := ctx.QueryInt64("milestone")
milestone, err := models.GetMilestoneByID(milestoneID)
diff --git a/templates/repo/issue/comment_tab.tmpl b/templates/repo/issue/comment_tab.tmpl
index 7c64170484..b1630824e5 100644
--- a/templates/repo/issue/comment_tab.tmpl
+++ b/templates/repo/issue/comment_tab.tmpl
@@ -5,7 +5,7 @@
</div>
<div class="ui bottom attached active tab segment" data-tab="write">
<textarea id="content" class="edit_area js-quick-submit" name="content" tabindex="4" data-id="issue-{{.RepoName}}" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.Repo.RepoLink}}">
-{{if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end}}</textarea>
+{{if .BodyQuery}}{{.BodyQuery}}{{else if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end}}</textarea>
</div>
<div class="ui bottom attached tab segment markdown" data-tab="preview">
{{.i18n.Tr "loading"}}