-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Introduce jquery formvalidator for com_languages #5046
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
Conversation
|
@DGT41 |
|
@smanzi It should be ok ok now! |
|
@DGT41 Travis is crying... should I test anyway? |
|
@smanzi Travis hasn’t finished yet but he should be ok with this change i made! Go ahead! |
|
@test success |
1 similar comment
|
@test success |
|
Moving to RTC as we have 2 successful tests. |
|
Creating an Override, it is OK. However, when the same page is accessed after saving, it loads the Override and generates this error: SyntaxError: syntax error The error is coming from here: $expired = ($this->state->get("cache_expired") == 1 ) ? '1' : '';var expired = ' . $expired . '; |
|
@anibalsanchez stupid mistake (missing quotes), I pushed a correction, sorry about that 😞 |
|
@test success! |
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.
here also, you wrapped the function to ready, but why? 😉
it unnecessary, there no reason to wait when DOM is ready, for define a function
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.
@Fedik you are right is not needed, but waiting for the DOM to become ready ensures that scripts will not block the DOM, which is described as best practice (is there a chance to call the function before the DOM is completed?) and will be nice if devs follow it.
Also a good reference for javascript code styling is this post in CMS Group
Of course somebody has to update the coding styles
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.
oh oh 😃
I have a doubt that writing function definition in jQuery ready() method can be a good practice, ( by link that you suggested I did not found any about it)
And I know only couple reasons when it can be not bad idea, but the current code do not related to any of these reasons 😄
Also this part of the code use nothing from jQuery, and can work very good without it 😉
And how it can block DOM? it do nothing with DOM, it just a definition.
If you do like you do, then JS parser parse jQuery.ready and your code in it, and execute jQuery.ready() for add function definition to waiting the ready event. Then on ready event jQuery execute your function definition.
If you do as it was before, without jQuery, then JS parser parse your code and execute your function definition.
So, you still think that it will be better if all start make such thing? 😄
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.
@Fedik This is indeed, as i said before, unneeded. The reason that I put it there was just to unify the script code. So when devs tries to bring their code to 3.4 (or whenever) they see a unique pattern on the core and just follow it.
What is very interesting for admin area is that if you take a 3.3.6 and apply all those PRs, for all pages (except the edit ones where you have a modal) the page loading time decreases by 20-30%. 🎉
Just to be clear here: if people think that this is a bad practice, I can revert this code to be plain js, no prob! ❔
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 think, the page loading/rendering time decreases because there no mootools anymore, and for the browser do not need to parse/execute mootools library 😉
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.
@Fedik Of course you are right it is the absence of a big javascript library file that reduces the loading times. I didn’t implied that this was because of the .ready() function 😉
|
I was merging your PRs but I totally agree with @Fedik here:
We should try to get as much code in plain JS as possible. I just checked it and we have some jQuery code inside In fact we officially support Mootools and jQuery and using jQuery on core makes it mandatory for everybody. |
|
@phproberto You want me to remove all the jQuery(document).ready(…); |
|
The most important part is not to tie core to other libraries and do not transmit that to other developers as something recommended. In our code we are loading jQuery and that's done in our own views so that wouldn't be a big problem. But yes, I'd like to see core not mixed with jQuery. I've created an issue for the existing jQuery code in |
|
Dammit for the closed ones the changes don’t come thru 😡 |
|
Yes they are now merged so we need a new PR for that :( |
|
@phproberto This is still open... |
|
Folks, I had to commit cd70e94 as editing or creating an override was broken |
|
@infograf768 You're right! Sorry, I didn't test that view; I tried installing a new language, but that is not com_languages but com_installer 😶 Is it normal that when I first try to install a new language I find the available languages list populated only by the following? I find it confusing... I would expect either all available languages or none at all... |
|
Please click on "Find languages". It solves this issue. No idea why we get a limited list. I even get a pkg_weblinks.xml sometimes in that list. |
|
@infograf768 yep, I know I have to click "Find languages" but I find weird to have the languages list "somehow" populated... |
|
Should I open an issue for this? |
|
@smanzi I am on it... |
|
OMG, you are on... EVERYTHING! 😄 |
|
@smanzi actually this is my bad... |
|
@DGT41 BTW, I have another that it is surely for you: get in touch on Skype when you have a second... |
|
I am on Skype |
|
@smanzi Actually my previous comment wasn’t supposed to be here. Of course I am not on this one, so go on and open an issue… 😄 |
|
ah, OK!! 😄 |
Executive summary
This PR converts the form validation on com_languages to use plain jquery (no mootools call on every form).
Also NO MORE INLINE SCRIPTS!
Testing
If no javascript errors are logged in your browser and the functionality remains the same your test is a pass in any other case please report the errors here
Please also check these:
administrator/index.php?option=com_checkin should demonstrate multiselect without mt
administrator/index.php?option=com_users&view=mail should demonstrate form sent and validate without mt
administrator/index.php?option=com_modules should demonstrate multiselect and combobox without mt
http://localhost/administrator/index.php?option=com_admin&view=sysinfo should demonstrate highlighter.js without mt
Logout and log in to demonstrate the use of noframes without mt.