loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix cancel button in the page of project edit not work (#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

authored by

sillyguodong and committed by
GitHub
d02e83a2 a9cceb05

+6 -3
+2
routers/web/org/projects.go
··· 245 245 return 246 246 } 247 247 248 + ctx.Data["projectID"] = p.ID 248 249 ctx.Data["title"] = p.Title 249 250 ctx.Data["content"] = p.Description 250 251 ctx.Data["redirect"] = ctx.FormString("redirect") 252 + ctx.Data["HomeLink"] = ctx.ContextUser.HomeLink() 251 253 252 254 ctx.HTML(http.StatusOK, tplProjectsNew) 253 255 }
+1
routers/web/repo/projects.go
··· 232 232 return 233 233 } 234 234 235 + ctx.Data["projectID"] = p.ID 235 236 ctx.Data["title"] = p.Title 236 237 ctx.Data["content"] = p.Description 237 238 ctx.Data["card_type"] = p.CardType
+1 -1
templates/projects/new.tmpl
··· 50 50 <div class="ui divider"></div> 51 51 <div class="ui left"> 52 52 {{if .PageIsEditProjects}} 53 - <a class="ui cancel button" href="{{.RepoLink}}/projects"> 53 + <a class="ui cancel button" href="{{$.HomeLink}}/-/projects{{if eq .redirect "project"}}/{{.projectID}}{{end}}"> 54 54 {{.locale.Tr "repo.milestones.cancel"}} 55 55 </a> 56 56 <button class="ui primary button">
+1 -1
templates/repo/projects/new.tmpl
··· 72 72 <div class="ui divider"></div> 73 73 <div class="ui left"> 74 74 {{if .PageIsEditProjects}} 75 - <a class="ui cancel button" href="{{.RepoLink}}/projects"> 75 + <a class="ui cancel button" href="{{.RepoLink}}/projects{{if eq .redirect "project"}}/{{.projectID}}{{end}}"> 76 76 {{.locale.Tr "repo.milestones.cancel"}} 77 77 </a> 78 78 <button class="ui primary button">
+1 -1
web_src/js/features/common-global.js
··· 322 322 // There are many "cancel button" elements in modal dialogs, Fomantic UI expects they are button-like elements but never submit a form. 323 323 // However, Gitea misuses the modal dialog and put the cancel buttons inside forms, so we must prevent the form submission. 324 324 // There are a few cancel buttons in non-modal forms, and there are some dynamically created forms (eg: the "Edit Issue Content") 325 - $(document).on('click', 'form .ui.cancel.button', (e) => { 325 + $(document).on('click', 'form button.ui.cancel.button', (e) => { 326 326 e.preventDefault(); 327 327 }); 328 328