Backpack, the simple web-based manager of to-dos, notes, ideas, and schedules from 37 Signals, has had an upgrade.

The team discussed someofthechanges, and the biggest addition is the ability to move any “widget” (note, to-do list, picture gallery, etc.) anywhere on the page, or even to another page.

We talked to Sam Stephenson, also of Prototype acclaim, to get his thoughts on the changes, and what we may see in Prototype and Script.aculo.us coming out of this practical work. He gave us some detailed thoughts, and posted them on the 37 Signals blog:

Sam on Backpack

Under the hood, Backpack’s Pages tab has been completely rewritten. We moved nearly all of the application’s UI logic out of hand-written JavaScript files and into Ruby using RJS templates. This resulted in approximately 1600 fewer lines of application JS, and let us deliver pages with substantially less markup, since the edit states are now loaded on-demand instead of included in bulk with each page load. In addition, we’re running Backpack on the latest versions of Rails, Prototype, and script.aculo.us from SVN.

Most of the custom JavaScript in the new Backpack is used for wiring the interface in reusable ways. We’ve built a handful of mini-libraries that sit on top of Prototype and script.aculo.us, and we’re using them in several of our other applications in addition to Backpack.

One of these libraries adds support for specifying a CSS selector for script.aculo.us Sortable containment. It uses Prototype 1.6’s new Function#wrap to add the behavior in an aspect-oriented way without modifying the original Sortable source code. This is the library that powers Backpack’s widget reordering. It’s currently being used in Backpack and Basecamp.

Another library, internally called Hover Observer, uses an unobtrusive technique (monitoring the entire page for mouse movement) to add and remove a “hover” class on element hierarchies with certain class names. Combined with CSS, this allows us to easily show the edit/delete/move “nubbins” when you mouse over widgets on the page, or show drop-down menus when you mouse over applications in Open Bar.
The library also lets us specify enter and exit delays, so if you accidentally mouse outside of a target area, the hover class isn’t removed immediately. Think of it as a cross-browser implementation of the :hover CSS pseudo-class, on steroids. Hover Observer was developed for Backpack and is now being used in Basecamp and Highrise.

The last library is tentatively known as Transitions, and provides an extremely simple API for animating transitions between DOM states. The animation resizes and fades an elementâ€™s content from one state to another, much like the effect you see when switching preference panes in OS X System Preferences. Youâ€™ll see the effect when you edit any item in Backpack. Because the API is simple, RJS-compatible, and easy to integrate into existing applications, we were able to develop it and drop it into Backpack in a single weekend.

I’m extremely pleased with how everything turned out, and I’m looking forward to open-sourcing as much of our JavaScript infrastructure as possible in
the very near future. If you have a Backpack account, I hope you’re pleased with the changes, too. :)