Saturday, February 28, 2009

Growl4Rails - Rails == Growl4???

I've had a few people ask how to setup Growl4Rails without using rails. It's pretty easy as is, although you may be a little miffed by the directory structure. Feel free to go in and munge with the source if you'd like it to be more flexible, or to update it to suit your needs. All of the path dependencies are in the CSS files.


First, grab the source from GitHub:
git clone --depth 1 git://github.com/jfiorato/growl4rails.git
After that, create and images/growl4rails, javascripts/growl4rails, and stylesheets/growl4rails directories under your public folder.

From the Growl4Rails source, copy the contents of the public/javascripts, public/images, and public/stylesheet directories to your newly created folders, respectively.

Then, make sure to copy prototype.js and effects.js to your javascripts directory.

Once all the resources are there, all you need to do is add the includes to your layout/masterpage/template:

<script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/effects.js" type="text/javascript"></script>

<script type="text/javascript" langauge="javascript">
var growl4rails_duration = 5000;
var growl4rails_max_showing = 5;
</script>

<script src="javascripts/growl4rails/growl4rails.js" type="text/javascript"></script>
<link href="stylesheets/growl4rails/growl4rails.css" media="screen" rel="stylesheet" type="text/css">