summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routers/web/org/projects.go7
-rw-r--r--routers/web/repo/projects.go7
-rw-r--r--templates/projects/new.tmpl1
-rw-r--r--templates/projects/view.tmpl2
-rw-r--r--templates/repo/projects/new.tmpl1
-rw-r--r--templates/repo/projects/view.tmpl2
6 files changed, 16 insertions, 4 deletions
diff --git a/routers/web/org/projects.go b/routers/web/org/projects.go
index 046100c72e..7b5eef32d8 100644
--- a/routers/web/org/projects.go
+++ b/routers/web/org/projects.go
@@ -233,6 +233,7 @@ func EditProject(ctx *context.Context) {
ctx.Data["title"] = p.Title
ctx.Data["content"] = p.Description
+ ctx.Data["redirect"] = ctx.FormString("redirect")
ctx.HTML(http.StatusOK, tplProjectsNew)
}
@@ -273,7 +274,11 @@ func EditProjectPost(ctx *context.Context) {
}
ctx.Flash.Success(ctx.Tr("repo.projects.edit_success", p.Title))
- ctx.Redirect(ctx.Repo.RepoLink + "/projects")
+ if ctx.FormString("redirect") == "project" {
+ ctx.Redirect(p.Link())
+ } else {
+ ctx.Redirect(ctx.ContextUser.HomeLink() + "/-/projects")
+ }
}
// ViewProject renders the project board for a project
diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go
index 967b81c608..29bd59c7a3 100644
--- a/routers/web/repo/projects.go
+++ b/routers/web/repo/projects.go
@@ -235,6 +235,7 @@ func EditProject(ctx *context.Context) {
ctx.Data["title"] = p.Title
ctx.Data["content"] = p.Description
ctx.Data["card_type"] = p.CardType
+ ctx.Data["redirect"] = ctx.FormString("redirect")
ctx.HTML(http.StatusOK, tplProjectsNew)
}
@@ -275,7 +276,11 @@ func EditProjectPost(ctx *context.Context) {
}
ctx.Flash.Success(ctx.Tr("repo.projects.edit_success", p.Title))
- ctx.Redirect(ctx.Repo.RepoLink + "/projects")
+ if ctx.FormString("redirect") == "project" {
+ ctx.Redirect(p.Link())
+ } else {
+ ctx.Redirect(ctx.Repo.RepoLink + "/projects")
+ }
}
// ViewProject renders the project board for a project
diff --git a/templates/projects/new.tmpl b/templates/projects/new.tmpl
index c96f948ded..826869ac5d 100644
--- a/templates/projects/new.tmpl
+++ b/templates/projects/new.tmpl
@@ -21,6 +21,7 @@
<form class="ui form grid" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div class="eleven wide column">
+ <input type="hidden" id="redirect" name="redirect" value="{{.redirect}}">
<div class="field {{if .Err_Title}}error{{end}}">
<label>{{.locale.Tr "repo.projects.title"}}</label>
<input name="title" placeholder="{{.locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required>
diff --git a/templates/projects/view.tmpl b/templates/projects/view.tmpl
index 14a876d8fd..474b22a2f1 100644
--- a/templates/projects/view.tmpl
+++ b/templates/projects/view.tmpl
@@ -46,7 +46,7 @@
{{if or $.CanWriteIssues $.CanWritePulls}}
<div class="column right aligned">
<div class="ui compact right small menu">
- <a class="item" href="{{$.Link}}/edit" data-id={{$.Project.ID}} data-title={{$.Project.Title}}>
+ <a class="item" href="{{$.Link}}/edit?redirect=project" data-id={{$.Project.ID}} data-title={{$.Project.Title}}>
{{svg "octicon-pencil"}}
<span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_edit"}}</span>
</a>
diff --git a/templates/repo/projects/new.tmpl b/templates/repo/projects/new.tmpl
index b65601c158..b53a47dc58 100644
--- a/templates/repo/projects/new.tmpl
+++ b/templates/repo/projects/new.tmpl
@@ -24,6 +24,7 @@
<form class="ui form grid" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div class="eleven wide column">
+ <input type="hidden" id="redirect" name="redirect" value="{{.redirect}}">
<div class="field {{if .Err_Title}}error{{end}}">
<label>{{.locale.Tr "repo.projects.title"}}</label>
<input name="title" placeholder="{{.locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required>
diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl
index f6bc6e1a42..bef9cb9bf0 100644
--- a/templates/repo/projects/view.tmpl
+++ b/templates/repo/projects/view.tmpl
@@ -50,7 +50,7 @@
{{if and (or $.CanWriteIssues $.CanWritePulls) (not $.Repository.IsArchived)}}
<div class="column right aligned">
<div class="ui compact right small menu">
- <a class="item" href="{{$.RepoLink}}/projects/{{.Project.ID}}/edit" data-id={{$.Project.ID}} data-title={{$.Project.Title}}>
+ <a class="item" href="{{$.RepoLink}}/projects/{{.Project.ID}}/edit?redirect=project" data-id={{$.Project.ID}} data-title={{$.Project.Title}}>
{{svg "octicon-pencil"}}
<span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_edit"}}</span>
</a>