Google Ajax Libraries API plugin

Plugin details

A Rails plugin that provides a convenient interface for these google ajax libraries.

Websitehttp://github.com/rpheath/google_ajax_libraries_api/tree/master Repositorygit://github.com/rpheath/google_ajax_libraries_api.git Author Ryan Heath Tags AJAX, api, Google LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install git://github.com/rpheath/google_ajax_libraries_api.git

Usage
=============
There are a couple of ways to get access to your library of choice. At this point, there are five supported libraries: jquery, prototype, scriptaculous, mootools, and dojo. This plugin supports them all. To include a library, you can use the convenience helpers in the head of your layout:

<%= google_mootools -%>
<%= google_jquery :version => '1.2.3' -%>
<%= google_prototype :uncompressed => true -%>
<%= google_dojo :version => '1.1.1', :uncompressed => true -%>


You get the idea. By default, the version will be the highest version supported. For instance, jQuery has two supported versions right now: 1.2.3 and 1.2.6. If you want to use 1.2.6, just use <%= google_jquery -%>.

If you need/want to load a few libraries at once, use the google_js_library_for() helper, like so:

<%= google_js_library_for :prototype, :scriptaculous, :jquery -%>
<%= google_js_library_for :prototype, :scriptaculous, :jquery, :uncompressed => true -%>


Pretty straight-forward. I should note, though, if you’re specifying a few libraries at once, the :version option becomes irrelevant, as I’d have no clue which library you were specifying a version for. And if you pass the :uncompressed option, it will apply to all libraries that support an uncompressed version.

I’m sure the code could be improved upon, as I wrote this farely quickly because I started using it in a few of my projects. Feel free to suggest changes and/or “fork and improve”.

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 3 months ago