Archive for the ‘javascript’ Category

Gettin My Mits on YUI 3 Widgets: Piemenu

Tuesday, December 23rd, 2008

I was given a small assignment at work – to develop a jazzed up front page for my group with links to all the apps/systems we offer (for those catching up, I work in Yahoo! Ops, making internal tools).

My manager suggested a pie menu as one of the ideas. “That’s crazy talk,” I thought at first. Pie menus are for non-profitable european video social networks. Then I thought about it, and decided to just write it – see if I’ve got some javascript chops (turns out, I do). If Schill and Dimitry can make pages with Javascript that look like they were made in Flash, so can I, damn it!

I’d been taking an occasional look at YUI3 PR2, and decided I’d try it on for size for this project. I must say, it fits. Extending the Widget class properly using Y.mix to add attributes and Y.extend to add methods ends up handling a lot of the dirty work for you, such as parameters and defaults. This is definitely a case where the framework is well designed, and staying within its bounds has enormous benefits.

Though I’m a huge code hoarder by nature, I’m just gonna throw the initial wireframe up on Github and link it here, feedback is welcome.

Docs on extending the widget class are here.

A small sample widget is here.

UPDATE: a simple proof of concept is here (click on the wrenches, and don’t expect too much)