mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-30 00:01:24 +00:00
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.
This commit is contained in:
parent
8cadd51bf2
commit
e52ac62d8e
|
@ -233,6 +233,7 @@ func EditProject(ctx *context.Context) {
|
||||||
|
|
||||||
ctx.Data["title"] = p.Title
|
ctx.Data["title"] = p.Title
|
||||||
ctx.Data["content"] = p.Description
|
ctx.Data["content"] = p.Description
|
||||||
|
ctx.Data["redirect"] = ctx.FormString("redirect")
|
||||||
|
|
||||||
ctx.HTML(http.StatusOK, tplProjectsNew)
|
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.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
|
// ViewProject renders the project board for a project
|
||||||
|
|
|
@ -235,6 +235,7 @@ func EditProject(ctx *context.Context) {
|
||||||
ctx.Data["title"] = p.Title
|
ctx.Data["title"] = p.Title
|
||||||
ctx.Data["content"] = p.Description
|
ctx.Data["content"] = p.Description
|
||||||
ctx.Data["card_type"] = p.CardType
|
ctx.Data["card_type"] = p.CardType
|
||||||
|
ctx.Data["redirect"] = ctx.FormString("redirect")
|
||||||
|
|
||||||
ctx.HTML(http.StatusOK, tplProjectsNew)
|
ctx.HTML(http.StatusOK, tplProjectsNew)
|
||||||
}
|
}
|
||||||
|
@ -275,8 +276,12 @@ func EditProjectPost(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("repo.projects.edit_success", p.Title))
|
ctx.Flash.Success(ctx.Tr("repo.projects.edit_success", p.Title))
|
||||||
|
if ctx.FormString("redirect") == "project" {
|
||||||
|
ctx.Redirect(p.Link())
|
||||||
|
} else {
|
||||||
ctx.Redirect(ctx.Repo.RepoLink + "/projects")
|
ctx.Redirect(ctx.Repo.RepoLink + "/projects")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ViewProject renders the project board for a project
|
// ViewProject renders the project board for a project
|
||||||
func ViewProject(ctx *context.Context) {
|
func ViewProject(ctx *context.Context) {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<form class="ui form grid" action="{{.Link}}" method="post">
|
<form class="ui form grid" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
<div class="eleven wide column">
|
<div class="eleven wide column">
|
||||||
|
<input type="hidden" id="redirect" name="redirect" value="{{.redirect}}">
|
||||||
<div class="field {{if .Err_Title}}error{{end}}">
|
<div class="field {{if .Err_Title}}error{{end}}">
|
||||||
<label>{{.locale.Tr "repo.projects.title"}}</label>
|
<label>{{.locale.Tr "repo.projects.title"}}</label>
|
||||||
<input name="title" placeholder="{{.locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required>
|
<input name="title" placeholder="{{.locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required>
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
{{if or $.CanWriteIssues $.CanWritePulls}}
|
{{if or $.CanWriteIssues $.CanWritePulls}}
|
||||||
<div class="column right aligned">
|
<div class="column right aligned">
|
||||||
<div class="ui compact right small menu">
|
<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"}}
|
{{svg "octicon-pencil"}}
|
||||||
<span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_edit"}}</span>
|
<span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_edit"}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<form class="ui form grid" action="{{.Link}}" method="post">
|
<form class="ui form grid" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
<div class="eleven wide column">
|
<div class="eleven wide column">
|
||||||
|
<input type="hidden" id="redirect" name="redirect" value="{{.redirect}}">
|
||||||
<div class="field {{if .Err_Title}}error{{end}}">
|
<div class="field {{if .Err_Title}}error{{end}}">
|
||||||
<label>{{.locale.Tr "repo.projects.title"}}</label>
|
<label>{{.locale.Tr "repo.projects.title"}}</label>
|
||||||
<input name="title" placeholder="{{.locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required>
|
<input name="title" placeholder="{{.locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required>
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
{{if and (or $.CanWriteIssues $.CanWritePulls) (not $.Repository.IsArchived)}}
|
{{if and (or $.CanWriteIssues $.CanWritePulls) (not $.Repository.IsArchived)}}
|
||||||
<div class="column right aligned">
|
<div class="column right aligned">
|
||||||
<div class="ui compact right small menu">
|
<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"}}
|
{{svg "octicon-pencil"}}
|
||||||
<span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_edit"}}</span>
|
<span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_edit"}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue