aboutsummaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
authoryp053272023-03-09 23:38:29 +0900
committerGitHub2023-03-09 08:38:29 -0600
commite52ac62d8e645c721060e6c9a2b0ab77eedf8fd6 (patch)
tree2259ae04d96cfe1679bbee559c5e397c412b5015 /routers
parent8cadd51bf295e6ff36ac36efed68cc5de34c9382 (diff)
Redirect to project again after editing it (#23326)
A part of https://github.com/go-gitea/gitea/pull/22865 We have edit buttons in projects list page and project view page. But after user edit a project, it will always redirect to the projects list page.
Diffstat (limited to 'routers')
-rw-r--r--routers/web/org/projects.go7
-rw-r--r--routers/web/repo/projects.go7
2 files changed, 12 insertions, 2 deletions
diff --git a/routers/web/org/projects.go b/routers/web/org/projects.go
index 046100c72..7b5eef32d 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 967b81c60..29bd59c7a 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