-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix .locale.Tr
function not found in delete modal
#23468
Conversation
I guess this change equals before. Because in this template, |
Just have a try, I see the error message:
it's |
As far as I've understood Go templates (please correct me if I misunderstood something): |
.locale.Tr
function not found in delete modal.locale.Tr
function not found in delete modal
In a template, So, if we write I guess the problem is caused by that this sub-template is called inside a |
@wxiaoguang unfortunately, I was never able to see the dialogue, not even during #23337. |
I just navigated to the page http://localhost:3000/user/settings/repos , let me see .... |
I guess the fix could be like this: diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl
index 2e107ca7f..d1cb60225 100644
--- a/templates/user/settings/repos.tmpl
+++ b/templates/user/settings/repos.tmpl
@@ -50,7 +50,7 @@
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="adopt">
- {{template "base/delete_modal_actions" .}}
+ {{template "base/delete_modal_actions" $}}
</form>
</div>
{{end}}
@@ -68,7 +68,7 @@
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="delete">
- {{template "base/delete_modal_actions" .}}
+ {{template "base/delete_modal_actions" $}}
</form>
</div>
{{end}} |
Hmm , I think I know your question now .... some pages are for special usage, for example, adopt repositories, adopt lfs files, etc. You need to have some unadopted repositories to make Gitea render that UI. I did a global search, I can find there are also similar problems in So I guess there are 4 lines need to be changed: 2 lines in And I find one more possible problem, the template name |
Yep, and I agree that all three other times, |
.locale.Tr
function not found in delete modal.locale.Tr
function not found in delete modal
{{svg "octicon-check" 16 "gt-mr-2"}} | ||
{{$.locale.Tr "modal.yes"}} | ||
</button> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not make another subtemplate with the trash icon? 3 repetitions is already worthy of a subtemplate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just need a rename.
Rename the delete_modal_actions
to modal_actions_yes_no
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to postpone this for a future PR, but yeah, we can of course do it in this one too…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either is fine, fix bugs first 😁
🎺 (for merge queue) |
* upstream/main: Replace a few fontawesome icons with svg (go-gitea#23602) Fix pagination on `/notifications/watching` (go-gitea#23564) Fix `.locale.Tr` function not found in delete modal (go-gitea#23468) fix submodule is nil panic (go-gitea#23588) `Publish Review` buttons should indicate why they are disabled (go-gitea#23598) Improve template error reporting (go-gitea#23396) Polyfill the window.customElements (go-gitea#23592) Add CHANGELOG for 1.19.0 (go-gitea#23583)
Caught by @wxiaoguang in #23337 (comment).
Additionally, there were three instances that have the same content as
templates/base/deletion_modal_actions.tmpl
, but that are not intended to delete something.Instead of renaming the template above, these instances were simply re-hard-coded again.
Renaming/improving the template above is left for future PRs.