humhub-contrib / legal

2 stars 9 forks source link

Wait for select2 to be loaded #69

Closed hmarth closed 5 months ago

hmarth commented 5 months ago

If the configuration page is loaded (legal/admin) and the user changes to the "Terms and conditions" tab, they can change the language. If the "Terms and conditions" tab is loaded "directly" (via legal/admin/page?pageKey=terms), select2 is not there initially. Changing languages is not possible, as the listener is not set.

yurabakhtin commented 5 months ago

@hmarth @luke- I have tried to reproduce this on several browsers by coping the URL legal/admin/page?pageKey=terms in new tab and in all cases I can select language as expected:

lang-selector

ArchBlood commented 5 months ago

The only way of having issues myself is for newly translated pages

yurabakhtin commented 5 months ago

@ArchBlood Thanks for the steps but I still could not reproduce it:

https://github.com/humhub-contrib/legal/assets/6995524/80977016-fce3-4854-b605-8aa9a0ad0a58

ArchBlood commented 5 months ago

@ArchBlood Thanks for the steps but I still could not reproduce it:

https://github.com/humhub-contrib/legal/assets/6995524/80977016-fce3-4854-b605-8aa9a0ad0a58

Thanks for testing, I'll see if I can replicate the issue again.

ArchBlood commented 5 months ago

Yeah, still getting this issue on my tests;

Uncaught TypeError: $(...).select2 is not a function
    at page?pageKey=terms&language=eu:1385:32

Which leads to this line of code $("#pageLangSelector").select2().on("select2:select", function(e) that fails, this P/R fixes the console errors so I can say that it does fix the issue.

yurabakhtin commented 5 months ago

@luke- You can merge this PR because @ArchBlood can reproduce the issue.