jQuery Roundup: Rails, Wordpress, and new plugins
Written by on May 21st, 2007 in Ajax News.
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:
-
page["#posts"].append render(:partial => ‘post’, :locals => {:post =>
@post})
#=> $("#posts").append("Post #29 info…");
page[".hide-this"].hide
#=> $(’.hide-this’).hide();
page["#foo"].html("bar").append("baz")
#=> $("#foo").html("bar").append("baz");
page["h1"].add_class "make-red"
#=> $("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.
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:
- jTip: Tooltip support
- tableFilter: a simple filtered table
Source: Ajaxian
Original Article: http://ajaxian.com/archives/jquery-roundup-rails-wordpress-and-new-plugins
