Ive been making an effort to learn a bit more about development, Ive got a very basic understanding of php and Ive had some exposure to jquery in other projects.
It would be much appreciated if someone could give me an example of where YUI is used in moodle and generally layman it all up for me.
The ID is dynamically generated and added to any element manipulated by YUI if it doesn't already have an ID. This is to improve performance of subsequent CSS-based lookups.
Generally though, you shouldn't need to use the IDs at all - you should be able to modify most of Moodle with the appropriate classes. If there is a YUI-based ID, it wouldn't have had an ID in the first place for you to hook into.
We use YUI all over Moodle - as an example, take a look at the course page, and turn editing on. Things like the indentation of activites, drag/drop of activities and sections, renaming activities, deleting activities, and the activity chooser are all written using YUI.
If you want to get into Moodle JS, I'd highly recommend reading some of our docs:
Also, the JS Rosetta Stone is handy if you have some experience with jQuery: http://www.jsrosettastone.com/.
Good luck, and if you have any questions, then this is the best place to ask them.
Thanks Andrew, theres lots of good info here
I was trying to change some aspects of the assignment grader table, so it works better on low resolution/small screens - hiding unnecessary columns, wrapping file submissions etc. As you suggested I got there with classes in the end.
I will need to look into some of the functions and spend some serious time on YUI tutorials but its always good to have something to work towards and I was testing subpages (an OU development) recently and found that they havent included the activity chooser, I assume this is because they dont use Ajax rather than due to any other difficulty. It was raised as an issue but they keep closing the tracker because the issue doesnt affect them.
Anyway, I would be feeling very smug if I managed to make the necessary tweaks in the not too distant future - Ill be sure to visit the forums more often!
Moodle and YUI
A Short Play by Alex Walker
"It looks like YUI is the best one for us. We're going for that."
"Cool. I've added YUI to Moodle's core, so everybody can start using it."
"I've updated my plugin to use YUI." "I've updated mine, too." "And me."
"I didn't want to admit it, but I've been using jQuery too."
"You guys are silly. YUI isn't that difficult. Learn it!"
"Whoa, looks like there's a lot of demand for jQuery from plugin developers. It also looks like Moodle's going to move to Bootstrap for a lot of the front-end layout, and Bootstrap builds on top of jQuery. Maybe we should include jQuery in the core, too."
"Yep, we'll add it to Moodle 2.5. It's not 'the new standard' for Moodle, because Moodle will still be built on YUI. But jQuery will be available for developers too."
Heh - nice one Alex,
One minor point - we're using the YUI version of Bootstrap JS, not jQuery. The only reason we include jQuery is for third-party developers and we recommend that you use YUI in preference. One of the main reasons we have included it is because if we don't, people try and use it anyway, and multiple versions of jQuery on the same page do not coexist well.
Thanks! thats interesting, I was secretly wondering if I could revert back to what i (kind of) know and use jquery instead. If its not best practise however, Ill just have to get to grips with YUI
Alex, Ive never read anything that made so much sense! Hero.