Adventures in FBJS

Another full day at ENTS developing Project Chronos, today I tackled the reminder creation UI. The facebooker gem has a handy helper class for generating forms in an FBML kind of way, this simplified the getting started a great deal. However once you move past the basic html input types it is no longer useful. My attempt to add a simple javascript calendar is where my troubles began.

The most important design aspect of my reminder app is the simplicity and ease of creating reminders. That in mind the default option of 3 select boxes to choose a date is not a viable option. Javascript calendars are normally a dime a dozen on the web and I figured it’d be no problem to add one in. That is when FBJS punched me in the face.

While I absolutely admire FBJS from the standpoint of a technical accomplishment on Facebook’s part, it is a pain in the ass if you want to reuse any libraries (and who doesn’t?). Facebooker has ported a lot of prototype to FBJS, which means a lot of normal rails helpers work. For the life of me though I couldn’t find any drop in calendars that were compatible or easily ported. What I did find on a Facebook developer forum was a kind of hacky solution that I could start working on (oh so greatful to whoever s10sys is at this point).

About this time Rob Davy invaded ENTS and I spent quite a bit of time over the remainder of the night chatting with him.

What work I did get done was my first attempt at hacking into Rails at a frameworky level. It is entirely possible that such was not the appropriate spot for my solution, but it was effective. I added a custom helper in the Facebooker form builder class to generate calendar fields with the appropriate bits of fbjs attached, and by 10pm when I left I actually have a functioning calendar control.

Next on my list is a time picker control. Since there are less graphical bits required and I’ve discovered how poorly most existing libraries play with fbjs I think I will just roll my own based on another solution I’ve seen and been intrigued by. It uses a simple 2 click interface to select any time.

If anyone knows of any wonderful fbjs libraries that my googling failed to find, please drop me a comment. Assuming they don’t exist, this seems like a huge gap waiting to be filled.


Leave a Reply