Growl4Rails is now production ready. I've added the ability to show multiple growls at once, as well as improved support for IE. Here's a screen shot of the multiple Growls:
Unfortunately, the multiple growls thing was an entire rewrite of the code, so the usage is quite different.
Now, when you setup the includes, you specify default duration and max number of growls to show. These arguments are optional and will default to 3000 milliseconds and 3, respectively.
<%= growl4rails_includes(3000, 5) %>
Also, when showing the growls, the args are now a single hash, with named keys:
<script type="text/javascript" language="javascript">
Growl4Rails.showGrowl({
image_path:"/images/download.png",
title:"Foo Bar.pdf",
message:"File is ready for download."
});
</script>
When you want to handle the click event, you can wire up the event like so:
var growl_id = Growl4Rails.showGrowl({
image_path:"/images/download.png",
title:"Foo Bar.pdf",
message:"File is ready for download."
});
document.observe(growl_id + ':clicked', function(event) {
console.log('Growl %s was clicked.', Event.findElement(event).id);
});
Again, it's open source, so if you want to contribute, or if you have any feedback, you can check out the project on GitHub.

11 comments:
tempted to use this to display the flash messages :)
Go for it! Let me know how it works out for you.
Why is this a Rails plugin and not a JavaScript library?
Hey Alex,
That's really all it is. The Rails plugin part just makes it really easy to distribute on to Rails apps. Given a small amount of effort you can tack on to any site Rails/HTML/Django/.NET.
Jim
You my friend, are awesome
For those that were wondering about using this without rails, I put up a blog post on how to do it.
http://www.writebetterbits.com/2009/02/growl4rails-rails-growl4.html
Nice, but whats about title or messsage alignment?
TeamCo, can you be more specific?
Thank you so much! This is perfect. :) I got it setup in no time.
Hi Jim,
I made a port of your library to use it as a symfony plugin (php):
http://www.symfony-project.org/plugins/sfGrowl4RailsPlugin
Cheers,
Alexis
Hey Alexis,
This is great. Thanks for letting me know.
Jim
Post a Comment