Monday, May 21st, 2007

jQuery Roundup: Rails, WordPress, and new plugins

Category: JavaScript, jQuery, Library

jQuery has had a recent set of interesting news, so we thought we should write it up:

jQuery works nicely with Rails.

Geoff Buesing assumed that switching his Rails application from Prototype to jQuery would be a pain, but then discovered that you can write jQuery-formatted Javascript with RJS templates, out-of-the-box, no special helpers or modifications necessary.

The trick is to use the RJS element proxy syntax — page[‘someid’]
— which outputs the Prototype syntax $(‘someid’). Just replace
someid with a jQuery selector, and method_missing magic will handle
the arbitrary jQuery methods chained to it.

Some examples:

  1. page["#posts"].append render(:partial => 'post', :locals => {:post =>
  2. @post})
  3. #=> $("#posts").append("Post #29 info…");
  5. page[".hide-this"].hide
  6. #=> $('.hide-this').hide();
  8. page["#foo"].html("bar").append("baz")
  9. #=> $("#foo").html("bar").append("baz");
  11. page["h1"].add_class "make-red"
  12. #=> $("h1").addClass("make-red");

Ryan Dunphey wanted an OS X dashboard widget to give him “simple, searchable, offline access to the API”, so while on a plane, he developed it.

jQuery Widget

This is great PR: WordPress 2.2 migrated to jQuery due to Matt reading criticism such as this.

New Plugins

A couple of new plugins include:

Posted by Dion Almaer at 8:21 am

2.1 rating from 100 votes


Comments feed TrackBack URI

Sensationalist misinformation tends to sway many. Sorry he fell for it.

Comment by Todd — May 21, 2007

Prototype has had a similar documentation widget for quite some time now.

Comment by Matt — May 21, 2007

The WP admin is hardly over to jQuery yet. The source is just included, and a few little specks of jQuery are here and there, but for the most part, the JS is Prototype-based.

Comment by Robin — May 21, 2007

I still don’t get all the buzz about the JS libraries and stuff, I really prefer to do my own code (even if it’s a little more time consumable), but hey, if there are so many people talking about, I’m gonna try some day when I’ll really need it.

Comment by Juca — May 21, 2007

Using JS Libraries and stuff can be like a business owner using third party software. Sure, the business owner doesnt NEED to use the third party software. She can create it herself after putting in the time to learn how to do it. But for her, business isnt about building software. Javascript libraries (to a lesser extent) can be an enabler for a developer to spend her time working on other things. If the library has a thriving community then she can get a level of reliability she may not have time to develop herself. And, she may not feel that she is the greatest thing to web programming and would like to use something developed by a quality concerned community as opposed to rolling her own.

Comment by Crit — May 21, 2007

Whenever I see the old arguments on why Prototype is bad, I feel like vomiting blood. Most of the arguments are not true now, such as modifying the loop (and if your code is broke because of this, then it means your code uses ugly hacks anyway), lacking documentation (there are tons of docs now), and et cetera.

There’s nothing to stop people from blindly including one library or another to follow a buzz. One can equally misuse jQuery if all they want is just remote Ajax loading.

Comment by kourge — May 21, 2007

Yea, but prototype still weights a ton.

Comment by nea — May 22, 2007

It doesn’t weigh a whole lot more than jQuery does. And I’d also like to say that it doesn’t matter.

Comment by Tim Cooijmans — May 22, 2007

Prototype 1.5.1 is 15kb compressed. A ton? Grow up and learn to compress like the big boys:

Comment by jack — May 22, 2007

can’t run on ff+windows or ie+windows?

====================:::::::firebug error report
AppleInfoButton is not defined
[Break on this error] flipElement.object = new AppleInfoButton(flipElement, document.getElementById(…
InfoButton.js (line 25)
widget is not defined
[Break on this error] jVer = widget.preferenceForKey(‘useVersion’) || ‘1.1.2’;
script.js (line 41)

Comment by zhsu — May 29, 2007

“Rails, WordPress, and new plugins” is just another variation of link bating to get readers and links to your site.

It is just like adding JobsEmployment at
to get links.

Tsk, tsk !!

Comment by JobsEmployment — May 2, 2009

I think it is the right way for wordpress. WordPress need more ajax plugins

Comment by sportshop — June 6, 2009

jQuery still needs to cover a lot of way into WordPress, a newbie wordpress webmaster is not that comfortable with jQuery.

Comment by spellathon — October 9, 2009

Leave a comment

You must be logged in to post a comment.