occasionally useful ruby, ubuntu, etc

13Nov/081

introducing…jquery_merb (sort of)

I love jQuery. I love Merb. I thought, so why not work on both? I tried this previously from the merb side with the now gone merb_multi_js plugin, which I had made a substantial amount of progress on before I killed it. It was designed to mimic rails and generate handy JavaScript for you not using Prototype.js, but whatever web framework you wanted (I of course had jQuery, Prototype.js, and I think YUI). Alas, I realized that because of some of its design principles, it would never be performance-friendly.

Enter jquery_merb, or jquery.merb.js.

This library takes on a different role; rather than generating javascript for you (ew) it's meant to be a collection of helpers that assist your coding in interacting with your Merb server. For instance, if you want to use AJAX to perform CRUD operations on a resource, instead of hacking together an ajax call you can say this:

$.merb.resource.read({resources: 'notes', id: 5, dataType: 'json'})

Neat huh? The interface isn't quite as clean as it could be, but alas, that's because of the inescapable fact that resources have singular and plural forms which can't be resolved programmatically in JavaScript.

The thing I've been working on for the past couple days actually does dip into the merb side, but only just. I think it would be cool to be able to easily reload a part (using AJAX) that you use in your view, without a lot of extra work from you (no special controller methods or templates, or even writing an ajax call). This would mean something as simple as $("#my_part").merb_reload(); and the part would reload with, say, the most recent blog posts. See here for more details.

So that's what I'm working on these days...

Comments (1) Trackbacks (0)
  1. You are talking in a foreign language here that I don’t understand…but I can still hear your “voice”…which is all a mom wants…!!!!!!


Leave a comment


No trackbacks yet.