1
0
Fork 0
forgejo/routers/web
wxiaoguang 6913053223
Start using template context function (#26254)
Before:

* `{{.locale.Tr ...}}`
* `{{$.locale.Tr ...}}`
* `{{$.root.locale.Tr ...}}`
* `{{template "sub" .}}`
* `{{template "sub" (dict "locale" $.locale)}}`
* `{{template "sub" (dict "root" $)}}`
* .....

With context function: only need to `{{ctx.Locale.Tr ...}}`

The "ctx" could be considered as a super-global variable for all
templates including sub-templates.


To avoid potential risks (any bug in the template context function
package), this PR only starts using "ctx" in "head.tmpl" and
"footer.tmpl" and it has a "DataRaceCheck". If there is anything wrong,
the code can be fixed or reverted easily.
2023-08-08 01:22:47 +00:00
..
admin Allow package cleanup from admin page (#25307) 2023-08-08 00:46:10 +00:00
auth Start using template context function (#26254) 2023-08-08 01:22:47 +00:00
devtest Make "cancel" buttons have proper type in modal forms (#25618) 2023-07-03 14:04:50 +08:00
events
explore Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
feed Add context parameter to some database functions (#26055) 2023-07-22 22:14:27 +08:00
healthcheck Remove db.DefaultContext in routers/ and cmd/ (#26076) 2023-07-23 23:47:27 -04:00
misc Serve pre-defined files in "public", add "security.txt", add CORS header for ".well-known" (#25974) 2023-07-21 12:14:20 +00:00
org Move web JSON functions to web context and simplify code (#26132) 2023-07-26 06:04:01 +00:00
repo Fix nil pointer dereference error when open link with invalid pull index (#26353) 2023-08-07 11:43:18 +08:00
shared Do not show Profile README when repository is private (#26295) 2023-08-04 14:45:33 +00:00
user Use more IssueList instead of []*Issue (#26369) 2023-08-07 19:26:40 +00:00
auth.go
auth_windows.go
base.go
goget.go
home.go
metrics.go
nodeinfo.go
swagger_json.go Start using template context function (#26254) 2023-08-08 01:22:47 +00:00
web.go Allow package cleanup from admin page (#25307) 2023-08-08 00:46:10 +00:00
webfinger.go Add a link to OpenID Issuer URL in WebFinger response (#26000) 2023-07-20 16:02:45 +08:00