Just Talk About Web

Techniques Behind Modern Web

Ajax - JavaScript




Looking for Prototype/script.aculo.us replacement on Rails? jRails project can be an answer if you prefer JQuery. Here is info from project site:

Features

jRails provides drop-in functionality for these existing Rails methods.

Prototype

  • form_remote_for
  • form_remote_tag
  • link_to_remote
  • observe_field
  • observe_form
  • periodically_call_remote
  • remote_form_for
  • submit_to_remote

Scriptaculous

  • draggable_element
  • drop_receiving_element
  • sortable_element
  • visual_effect

RJS

  • hide
  • insert_html
  • remove
  • replace
  • replace_html
  • show
  • toggle

Visual Effects

The visual effects in jRails are based on the new jquery-fx library. jRails currently uses a slightly modified version of jquery fx code to get some of the desired effects. This code is evolving and is subject to change. In the meatime, you can get a taste of the visual effects that are currently available.

Appear, Fade, Puff, BlindDown, BlindUp, BlindRight, BlindLeft, SwitchOff, SwitchOn, SlideDown, SlideUp, DropIn, DropOut, Shake, Pulsate, Squish, Fold, FoldOut, Grow, Shrink, Highlight

How to use

Just install and go! Once installed, the previous Prototype/script.aculo.us helpers will be replaced by jQuery ones. In order for them to function correctly, just include the appropriate javascript files in the head of your page.

1
2
3
4
5
<script src="/javascripts/jquery.js" type="text/javascript"></script>
<script src="/javascripts/jquery-ui.js" type="text/javascript"></script>
<script src="/javascripts/jquery-fx.js" type="text/javascript"></script>
<script src="/javascripts/jrails.js" type="text/javascript"></script>
<script src="/javascripts/jrails.js" type="text/javascript"></script>

You can also use the Rails javascript_include_tag helper with :default to load them automagically.

1
<%= javascript_include_tag :defaults %>

Install

To install the jRails plugin:

1
.script/plugin install http://ennerchi.googlecode.com/svn/trunk/plugins/jrails

Then copy the javascript files in the plugin folder to your javascripts directory.


Recommended Reading: This site recommends Website Magazine for 'Net Success

Don't forget to subscribe so you don't miss out on future posts!

Do you need GWT on Rails?

Oh, my first thought was "It's silly to add Java to Rails" because normally GWT uses the Java language to generate JavaScript. But I changed my mind after reading Jon Crosby's answers to a short interview from InfoQ: Most of Java's weight comes from JEE, which is not part of GWT on Rails. Client side GWT uses the Java language to ...

  • 0 Comments
  • Filed under: GWT, Ruby on Rails
  • Faster Ajax Applications

    I found this stuff really great! download (m4v) In this presentation, Julien -- author of the YUI Compressor and the YUI Browser History Manager -- covers several major performance topics: Developing for high performance High performance page load High performance JavaScript High performance DHTML High performance layout and CSS High performance Ajax Performance measurement tools You can download PowerPoint slides here or view them on Slideshare Thanks ...

    JavaScript Object Extension

    You may never use object extension in Javascript just because you, and many others, believe that a prototype based OOP languages like JS are unable to support this classical OOP feature. Matt Snider has comprehensive articles about object extension in JavaScript that show how JQuery (<= v1.2) and Prototype (<=v1.5) frameworks use "member copy" method, a brutal force technique to iterate ...

    Premium Sponsors

    Career Opportunities

    Advertisements