sfGrowl4RailsPlugin - 1.0.1

Provide a helper to use Growl4Rails

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source | Show as Markdown

sfGrowl4RailsPlugin symfony plugin

Port of Jim Fiorato Rails plugin Growl4Rails to Symfony.

Growl4Rails is a javascript component that provides the UI for growl-like notifications in your rails application.

This plugin requires Prototype 1.6 or higher and Scriptaculous 1.7 or higher, use Fabien Potencier sfPrototypePlugin plugin.

Installation

*-----------

* For symfony 1.0.x
symfony plugin-install http://plugins.symfony-project.com/sfGrowl4RailsPlugin

Usage

*----

Growl4Rails.showGrowl method takes a single hash as an argument. The hash can have the following keys:

image_path - 32x32 icon title - title of the growl message - the growl message

<?php use_helper('Growl4Rails') ?>
<?php javascript_tag(growl4rails_growl('images/icon.png', 'System Notification', 'The user has been added.')); ?>

OR

<?php
    link_to_remote(image_tag('icon').__('add'), array(
        'update' => 'c_div',
        'url'    => 'user/add?id='.$id,
        'complete' => visual_effect('highlight', 'c_div').growl4rails_growl('user_icon', $user->getName(), __('the user has been added')),
    ));
 ?>

OR

<script type="text/javascript" language="javascript">
  Growl4Rails.showGrowl({image_path:"/images/download.png", title:"Foo Bar.pdf", message:"File is ready for download."});
</script>

To handle the 'click' event from the Growl, you can do the following:

<script type="text/javascript" language="javascript">
  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);
  });
 
</script>

Changelog

*--------

2010-06-18 | 1.0.0

Initial public release.

=== 2010-06-19 | 1.0.1 ====

Added prototype and scriptaculous libraries request. growl4rails_growl() updated for flexibilty.

Authors

*------

Jim Fiorato -- http://www.writebetterbits.com Original implementation

Alexis Moreno -- http://www.xeux.com.pa Symfony implementation

License

*------ For the full copyright and license information, please view the LICENSE file that was distributed with this source code.