Putting Some Backbone Into Posts 2 Posts

The last major release of WordPress (3.5) got the first dose of Backbone.js in the form of the revamped media manager.

Since I’ve been itching to play around with it for a while, I decided to backboneify the javascript-heavy metabox from the Posts 2 Posts plugin, following this guide.

In the first part, I organized everything into Backbone Views. Even though there were some awkward parts, I already felt this was a big improvement.

In the second part, I started using proper Backbone Models, successfully separating AJAX logic from DOM manipulation.

After this little experience, I think Trek’s summary is spot on:

Backbone is approachable if you've spent some time writing applications with jQuery and are familiar with callback-style evented architectures. Backbone's DNA is basically jQuery custom events on steroids.

P2P 1.5 isn’t ready yet, but if you want to play around with it, you can get it straight from github:

git clone --recursive git://github.com/scribu/wp-posts-to-posts.git

comments powered by Disqus