summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routers/web/repo/issue.go9
-rw-r--r--templates/repo/issue/new_form.tmpl1
2 files changed, 9 insertions, 1 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 7498830d94..03bdbec80c 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -803,6 +803,9 @@ func NewIssue(ctx *context.Context) {
ctx.Data["Project"] = project
}
+ if len(ctx.Req.URL.Query().Get("project")) > 0 {
+ ctx.Data["redirect_after_creation"] = "project"
+ }
}
RetrieveRepoMetas(ctx, ctx.Repo.Repository, false)
@@ -990,7 +993,11 @@ func NewIssuePost(ctx *context.Context) {
}
log.Trace("Issue created: %d/%d", repo.ID, issue.ID)
- ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + fmt.Sprint(issue.Index))
+ if ctx.FormString("redirect_after_creation") == "project" {
+ ctx.Redirect(ctx.Repo.RepoLink + "/projects/" + fmt.Sprint(form.ProjectID))
+ } else {
+ ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + fmt.Sprint(issue.Index))
+ }
}
// commentTag returns the CommentTag for a comment in/with the given repo, poster and issue
diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl
index f208416261..1089c82415 100644
--- a/templates/repo/issue/new_form.tmpl
+++ b/templates/repo/issue/new_form.tmpl
@@ -236,5 +236,6 @@
{{end}}
</div>
</div>
+ <input type="hidden" name="redirect_after_creation" value="{{.redirect_after_creation}}">
</div>
</form>