After I release the version 0.1, some people told me that it would be better that use jquery_ as the helpers' prefix. The reason is that the helpers with jquery_ prefix are more readable. I accepted this suggestion and from version 0.2 on, each helper will use jquery_ as its prefix.
This change, of course, is compatible with the jq_ prefix because I use the alias_method to make them compatible. That's why Ruby is so popular -- powerful, elegant, and easy. :-p
Wednesday, September 26, 2007
Prefix jq_ OR jquery_ ?
jq_visual_effect's bug
There's a little bug in version 0.1. The jq_visual_effect helper generates the default speed with an unquoted string. For example, it should be:$('#me').fadeTo('normal', opa, function(){});
but the buggy method generates:$('#me').fadeTo(normal, opa, function(){});
There are 2 ways to eliminate this bug.
- You can pass the
:speedargument with"'slow'","'normal'"or"'fast'"(i.e. add the quote yourself). - The other way is to modify the
jq_visual_effecthelper inlib/jq4r.rband add quotes around${speed}.
Sunday, September 23, 2007
What will be done in 0.2?
I want to add jQuery UI helpers in version 0.2. Although this jQuery plugin has simplified the code of writing web UIs, it could be more easier to RoR developers if some ``templates'' are included in the jq4r plugin.
If you want to use another features in jq4r, please tell me :-)
Thursday, September 20, 2007
jq4r version 0.1 released
In jq4r version 0.1, the following helpers are provided:
jq_link_to_remote
This method works as the originallink_to_remotemethod. It creates a link tag but overrides the click event handler to send request to a remote action. The relationship betweenjq_link_to_remoteandlink_to_remoteis thatjq_link_to_remoteis a jQuery-based implementation oflink_to_remotejq_load_from_remote
This method also creates a link to a remote action but update the content (innerHTML) of a element by the response of a remote action. It's a simplified version ofjq_link_to_remote, because it simply generates$(elem).load()script instead of$.ajax(...).jq_form_remote_tag
As the originalform_remote_tag, it creates theformtag and overrides the submit event handler.jq_form_remote_tagis the jQuery-based implementation ofform_remote_tag.jq_remote_form_for
Asjq_form_remote_tag, this method is another way to create theformtag with AJAX actions.jq_submit_to_remote
Creates a button tag (accurately, aninputtag) thats submit data to a remote action. If the data are not specified, it will submit whole fields' values within aform.jq_periodically_call_remote
Requests a remote action periodically. With:frequencyoption you man specify how long is the request be fired.jq_observe_field
Observes a field within a form. While the timer event comes (if you specify the:frequencyoption) or there's something changed within the field, the callback function will be executed.jq_observe_form
Asjq_observe_form, it observes a form, instead.jq_visual_effect
By callingjq_visual_effect, you can make animations in the page. As the originalvisual_effect, the first parameter is the effect's name. In jq4r version 0.1, you may use:animate,:slide_up / :slide_down, and:fade_in / :fade_out / :fade_to.
Check jq4r out!
The Rails framework installed the Prototype.js & Scriptaculous as its default JavaScript framework and defined many useful helper methods for easing the design of JavaScript(especially, AJAX).
jq4r is a Rails plugin, which installs the jQuery JavaScript framework and provides useful helper methods, too. I wish this plugin also eases the design of the javascripts and make your RHTML clean.
Just go to the jq4r project's page, and send me feedbacks if you have interesting ideas or suggestions.




