javascript auto include plugin

Plugin details

This plugin automatically includes javascript files that mirror an applications view structure.

Websitehttp://hosting.media72.co.uk/blog/2008/05/13/javascript-auto-include-rails-plugin/ Repositoryhttp://kernowsoul.com/svn/plugins/javascript_auto_include/ Author Jamie Dyer Tags views, Javascript LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install http://kernowsoul.com/svn/plugins/javascript_auto_include/

Add the following to the head of your template file

<%= javascript_auto_include_tags %>



Now each time the template is loaded javascript files in the public/javascripts/views
folder that correspond to the name of the current controller or view will be auto
loaded. For example:

 /public
   /javascripts
     /views
       users.js
       /users
         edit.js
       roles.js
       /accounts
         show.js



Assuming the above file structure loading each of the following urls would load:

 mydomain.com/users             # loads users.js
 mydomain.com/users/edit/1      # loads users.js and edit.js
 mydomain.com/users/show/1      # loads users.js
 mydomain.com/roles             # loads roles.js
 mydomain.com/accounts          # no js files loaded
 mydomain.com/accounts/show/1   # loads show.js



Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: Guest, over 2 years ago