Skip to content

Commit 863da7d

Browse files
authored
Fix cancel button in the page of project edit not work (go-gitea#23655) (go-gitea#23813)
Backport go-gitea#23655 Before, in project edit page, the cancel button is not work. https://user-images.githubusercontent.com/33891828/227182731-6478e29f-0e52-48c4-beb0-6a7d1dda6a1d.mov 1. The wrong classname `cancel` was added to the `<a>` tag. That classname caused the default click event of `<a>` tag to be cancelled. Because we have the following settings in the global. So I remove the classname `cancel`. https://github.com/go-gitea/gitea/blob/9be90a58754061171bbd5025d85d2b891364efd3/web_src/js/features/common-global.js#L325-L327 2. Another change is that page will redirect to the previous page. https://user-images.githubusercontent.com/33891828/227187326-c653c6d6-9715-440f-a732-ba0a6f012c81.mov
1 parent 1cad923 commit 863da7d

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

routers/web/org/projects.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,11 @@ func EditProject(ctx *context.Context) {
232232
return
233233
}
234234

235+
ctx.Data["projectID"] = p.ID
235236
ctx.Data["title"] = p.Title
236237
ctx.Data["content"] = p.Description
237238
ctx.Data["redirect"] = ctx.FormString("redirect")
239+
ctx.Data["HomeLink"] = ctx.ContextUser.HomeLink()
238240

239241
ctx.HTML(http.StatusOK, tplProjectsNew)
240242
}

routers/web/repo/projects.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ func EditProject(ctx *context.Context) {
232232
return
233233
}
234234

235+
ctx.Data["projectID"] = p.ID
235236
ctx.Data["title"] = p.Title
236237
ctx.Data["content"] = p.Description
237238
ctx.Data["card_type"] = p.CardType

templates/projects/new.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<div class="ui divider"></div>
4949
<div class="ui left">
5050
{{if .PageIsEditProjects}}
51-
<a class="ui primary basic button" href="{{.RepoLink}}/projects">
51+
<a class="ui primary basic button" href="{{$.HomeLink}}/-/projects{{if eq .redirect "project"}}/{{.projectID}}{{end}}">
5252
{{.locale.Tr "repo.milestones.cancel"}}
5353
</a>
5454
<button class="ui green button">

templates/repo/projects/new.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<div class="ui divider"></div>
7373
<div class="ui left">
7474
{{if .PageIsEditProjects}}
75-
<a class="ui primary basic button" href="{{.RepoLink}}/projects">
75+
<a class="ui primary basic button" href="{{.RepoLink}}/projects{{if eq .redirect "project"}}/{{.projectID}}{{end}}">
7676
{{.locale.Tr "repo.milestones.cancel"}}
7777
</a>
7878
<button class="ui green button">

0 commit comments

Comments
 (0)