Troggle is a project mainly written in ..., it's free.
A jQuery plugin to toggle Rails 2.x attributes
.troggle( model_string, attribute_string, [plural form of model string] )
Description: This JQuery plugin is for toggling a Ruby on Rails 2.x attribute using AJAX/jQuery with a standard fadeOut and fadeIn effect. It assumes Rails 2.x with authenticity token using format.json channel. This plugin should work for any model and attribute with a standard REST update function. For models with irregular plural forms, the irregular plural can be passed in as a third argument.
Just cut and paste the contents of troggle.js into your application.js and follow the example below.
Required fields set in the Rails view:
AUTH_TOKEN: The rails authenticity token must be set in a javascript tag. iid: the integer id of the model instance must be set on the displaying div tag value: model.attribute must be set on the displaying div tag
HTML Example:
$('.toggle_user_publish').troggle("user", "publish");
HAML Example: :javascript var AUTH_TOKEN = #{form_authenticity_token.inspect}; #Required $(function() { $('.toggle_published').troggle("user", "publish"); });