Backport #19172 Extend issues/new/choose to pass the project id and change New Issue link on project page to use new/choose Fix #19170 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
23b8214549
commit
4b7cb813e6
3 changed files with 12 additions and 5 deletions
|
@ -843,12 +843,19 @@ func NewIssue(ctx *context.Context) {
|
||||||
func NewIssueChooseTemplate(ctx *context.Context) {
|
func NewIssueChooseTemplate(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.issues.new")
|
ctx.Data["Title"] = ctx.Tr("repo.issues.new")
|
||||||
ctx.Data["PageIsIssueList"] = true
|
ctx.Data["PageIsIssueList"] = true
|
||||||
ctx.Data["milestone"] = ctx.FormInt64("milestone")
|
|
||||||
|
|
||||||
issueTemplates := ctx.IssueTemplatesFromDefaultBranch()
|
issueTemplates := ctx.IssueTemplatesFromDefaultBranch()
|
||||||
ctx.Data["NewIssueChooseTemplate"] = len(issueTemplates) > 0
|
|
||||||
ctx.Data["IssueTemplates"] = issueTemplates
|
ctx.Data["IssueTemplates"] = issueTemplates
|
||||||
|
|
||||||
|
if len(issueTemplates) == 0 {
|
||||||
|
// The "issues/new" and "issues/new/choose" share the same query parameters "project" and "milestone", if no template here, just redirect to the "issues/new" page with these parameters.
|
||||||
|
ctx.Redirect(fmt.Sprintf("%s/issues/new?%s", ctx.Repo.Repository.HTMLURL(), ctx.Req.URL.RawQuery), http.StatusSeeOther)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Data["milestone"] = ctx.FormInt64("milestone")
|
||||||
|
ctx.Data["project"] = ctx.FormInt64("project")
|
||||||
|
|
||||||
ctx.HTML(http.StatusOK, tplIssueChoose)
|
ctx.HTML(http.StatusOK, tplIssueChoose)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<br/>{{.About | RenderEmojiPlain}}
|
<br/>{{.About | RenderEmojiPlain}}
|
||||||
</div>
|
</div>
|
||||||
<div class="column right aligned">
|
<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>
|
<a href="{{$.RepoLink}}/issues/new?template={{.FileName}}{{if $.milestone}}&milestone={{$.milestone}}{{end}}{{if $.project}}&project={{$.project}}{{end}}" class="ui green button">{{$.i18n.Tr "repo.issues.choose.get_started"}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<br/>{{.i18n.Tr "repo.issues.choose.blank_about"}}
|
<br/>{{.i18n.Tr "repo.issues.choose.blank_about"}}
|
||||||
</div>
|
</div>
|
||||||
<div class="column right aligned">
|
<div class="column right aligned">
|
||||||
<a href="{{.RepoLink}}/issues/new{{if .milestone}}?milestone={{.milestone}}{{end}}" class="ui green button">{{$.i18n.Tr "repo.issues.choose.get_started"}}</a>
|
<a href="{{.RepoLink}}/issues/new?{{if .milestone}}&milestone={{.milestone}}{{end}}{{if $.project}}&project={{$.project}}{{end}}" class="ui green button">{{$.i18n.Tr "repo.issues.choose.get_started"}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="column right aligned">
|
<div class="column right aligned">
|
||||||
{{if and .CanWriteProjects (not .Repository.IsArchived)}}
|
{{if and .CanWriteProjects (not .Repository.IsArchived)}}
|
||||||
<a class="ui green button show-modal item" href="{{$.RepoLink}}/issues/new?project={{$.Project.ID}}">{{.i18n.Tr "repo.issues.new"}}</a>
|
<a class="ui green button show-modal item" href="{{$.RepoLink}}/issues/new/choose?project={{$.Project.ID}}">{{.i18n.Tr "repo.issues.new"}}</a>
|
||||||
<a class="ui green button show-modal item" data-modal="#new-board-item">{{.i18n.Tr "new_project_board"}}</a>
|
<a class="ui green button show-modal item" data-modal="#new-board-item">{{.i18n.Tr "new_project_board"}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
<div class="ui small modal new-board-modal" id="new-board-item">
|
<div class="ui small modal new-board-modal" id="new-board-item">
|
||||||
|
|
Reference in a new issue