wxiaoguang
c0d105609f
Add DumpVar
helper function to help debugging templates (#24262)
I guess many contributors might agree that it's really difficult to
write Golang template. The dot syntax `.` confuses everyone: what
variable it is ....
So, we can use a `{{DumpVar .ContextUser}}` to look into every variable
now.
![image](https://user-images.githubusercontent.com/2114189/233692383-f3c8f24d-4465-45f8-839b-b63e00731559.png)
And it can even dump the whole `ctx.Data` by `{{DumpVar .}}`:
```
dumpVar: templates.Vars
{
"AllLangs": [
{
"Lang": "id-ID",
"Name": "Bahasa Indonesia"
},
...
"Context": "[dumped]",
"ContextUser": {
"AllowCreateOrganization": true,
"AllowGitHook": false,
"AllowImportLocal": false,
...
"TemplateLoadTimes": "[func() string]",
"TemplateName": "user/profile",
"Title": "Full'\u003cspan\u003e Name",
"Total": 7,
"UnitActionsGlobalDisabled": false,
"UnitIssuesGlobalDisabled": false,
"UnitProjectsGlobalDisabled": false,
"UnitPullsGlobalDisabled": false,
"UnitWikiGlobalDisabled": false,
"locale": {
"Lang": "en-US",
"LangName": "English",
"Locale": {}
}
...
---------
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: silverwind <me@silverwind.io>
2023-04-22 13:28:20 -04:00
..
2023-04-17 13:49:47 -04:00
2023-02-06 09:49:21 +08:00
2022-11-27 18:20:29 +00:00
2023-04-12 18:16:45 +08:00
2023-04-12 18:16:45 +08:00
2023-04-21 13:15:49 -04:00
2023-04-07 21:25:49 +08:00
2023-04-13 18:41:04 -04:00
2023-04-17 11:37:23 +08:00
2022-11-27 18:20:29 +00:00
2023-04-20 04:08:58 -04:00
2023-04-17 11:37:23 +08:00
2023-04-12 18:16:45 +08:00
2023-01-05 13:58:51 +02:00
2022-12-29 10:57:15 +08:00
2022-11-27 18:20:29 +00:00
2023-04-19 13:50:10 -04:00
2023-02-15 21:37:34 +08:00
2023-04-19 22:08:01 -04:00
2023-01-29 09:49:51 -06:00
2023-03-14 16:09:01 -04:00
2022-11-27 18:20:29 +00:00
2022-11-27 18:20:29 +00:00
2023-03-08 15:40:04 -05:00
2023-03-29 14:32:26 +08:00
2023-04-19 21:40:42 +08:00
2023-01-26 22:45:49 -06:00
2022-12-02 22:14:57 +08:00
2023-04-10 16:44:02 +08:00
2023-03-28 11:10:24 -04:00
2023-04-21 16:32:25 -04:00
2023-04-17 15:05:19 -04:00
2022-11-27 18:20:29 +00:00
2023-02-08 19:54:01 +02:00
2023-02-18 21:17:39 +02:00
2022-11-27 18:20:29 +00:00
2023-04-13 18:41:04 -04:00
2023-01-31 09:45:19 +08:00
2023-04-12 18:16:45 +08:00
2023-04-02 17:53:37 +08:00
2022-12-02 22:14:57 +08:00
2022-11-27 18:20:29 +00:00
2023-04-17 23:10:40 -04:00
2023-02-03 18:11:48 -05:00
2023-02-11 08:39:50 +08:00
2022-11-27 18:20:29 +00:00
2023-04-12 18:16:45 +08:00
2023-04-13 18:41:04 -04:00
2022-11-27 18:20:29 +00:00
2023-01-31 10:08:05 +01:00
2022-11-27 18:20:29 +00:00
2023-04-12 18:16:45 +08:00
2023-02-22 14:21:46 -05:00
2023-04-13 18:41:04 -04:00
2023-04-19 15:30:10 -04:00
2022-12-30 23:31:00 +08:00
2022-11-27 18:20:29 +00:00
2023-03-28 11:10:24 -04:00
2023-04-17 11:35:57 -04:00
2023-04-12 18:16:45 +08:00
2022-11-27 18:20:29 +00:00
2022-11-27 18:20:29 +00:00
2023-04-22 13:28:20 -04:00
2023-04-21 16:32:25 -04:00
2023-04-15 13:01:54 +02:00
2023-04-17 11:37:23 +08:00
2023-02-05 15:29:03 +08:00
2023-03-07 22:40:41 -05:00
2022-11-27 18:20:29 +00:00
2022-11-27 18:20:29 +00:00
2022-11-27 18:20:29 +00:00
2022-11-27 18:20:29 +00:00
2023-04-12 18:16:45 +08:00
2023-02-08 14:44:42 +08:00
2023-04-20 14:49:06 -04:00
2023-01-01 23:23:15 +08:00