0
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-02-19 00:40:08 +01:00
forgejo/routers/web/repo
wxiaoguang ce73492d6f
Refactor ctx in templates ()
Before, the `dict "ctx" ...` map is used to pass data between templates.

Now, more and more templates need to use real Go context:

* 
* 


`ctx` is a Go concept for `Context`, misusing it may cause problems, and
it makes it difficult to review or refactor.

This PR contains 2 major changes:

* In the top scope of a template, the `$` is the same as the `.`, so the
old labels_sidebar's `root` is the `ctx`. So this `ctx` could just be
removed.
bd7f218dce
* Rename all other `ctx` to `ctxData`, and it perfectly matches how it
comes from backend: `"ctxData": ctx.Data`.
7c01260e1d



From now on, there is no `ctx` in templates. There are only:

* `ctxData` for passing data
* `Context` for Go context
2023-03-02 11:44:06 -06:00
..
actions Require approval to run actions for fork pull request () 2023-02-24 15:58:49 +08:00
activity.go
attachment.go
blame.go Add context cache as a request level cache () 2023-02-15 21:37:34 +08:00
branch.go Use context parameter in services/repository () 2023-02-28 16:17:51 -06:00
cherry_pick.go
commit.go Add context cache as a request level cache () 2023-02-15 21:37:34 +08:00
compare.go Use beforeCommit instead of baseCommit () 2023-02-20 11:56:07 +08:00
download.go Use context parameter in models/git () 2023-01-09 11:50:54 +08:00
editor.go
editor_test.go
find.go Implement FSFE REUSE for golang files () 2022-11-27 18:20:29 +00:00
http.go Use context parameter in services/repository () 2023-02-28 16:17:51 -06:00
http_test.go
issue.go Refactor ctx in templates () 2023-03-02 11:44:06 -06:00
issue_content_history.go Move helpers to be prefixed with gt- () 2023-02-13 17:59:59 +00:00
issue_dependency.go Fix improper HTMLURL usages in Go code () 2023-02-11 14:34:11 +08:00
issue_label.go Add loading yaml label template files () 2023-03-02 01:44:23 +02:00
issue_label_test.go
issue_lock.go Fix improper HTMLURL usages in Go code () 2023-02-11 14:34:11 +08:00
issue_stopwatch.go Speed up HasUserStopwatch & GetActiveStopwatch () 2023-02-27 13:46:00 -05:00
issue_test.go
issue_timetrack.go Fix improper HTMLURL usages in Go code () 2023-02-11 14:34:11 +08:00
issue_watch.go Fix improper HTMLURL usages in Go code () 2023-02-11 14:34:11 +08:00
lfs.go Refactor git command package to improve security and maintainability () 2023-02-04 10:30:43 +08:00
main_test.go
middlewares.go
migrate.go
milestone.go
packages.go Use dynamic package type list () 2022-12-29 00:31:54 +01:00
patch.go Redirect to the commit page after applying patch () 2023-02-24 16:56:41 +00:00
projects.go Preview images for Issue cards in Project Board view () 2023-02-11 16:12:41 +08:00
projects_test.go
pull.go Use context parameter in services/repository () 2023-02-28 16:17:51 -06:00
pull_review.go Fix improper HTMLURL usages in Go code () 2023-02-11 14:34:11 +08:00
release.go Fix improper HTMLURL usages in Go code () 2023-02-11 14:34:11 +08:00
release_test.go
render.go
repo.go Use context parameter in services/repository () 2023-02-28 16:17:51 -06:00
runners.go Implement actions () 2023-01-31 09:45:19 +08:00
search.go Fix improper HTMLURL usages in Go code () 2023-02-11 14:34:11 +08:00
setting.go Use context parameter in services/repository () 2023-02-28 16:17:51 -06:00
setting_protected_branch.go Use context parameter in services/repository () 2023-02-28 16:17:51 -06:00
setting_secrets.go Add user secrets () 2023-02-01 20:53:04 +08:00
settings_test.go
tag.go Add main landmark to templates and adjust titles () 2023-02-01 22:56:10 +00:00
topic.go
treelist.go
view.go Rename repo.GetOwner to repo.LoadOwner () 2023-02-18 20:11:03 +08:00
view_test.go
webhook.go Add context cache as a request level cache () 2023-02-15 21:37:34 +08:00
wiki.go Use context parameter in models/git () 2023-01-09 11:50:54 +08:00
wiki_test.go