g_flash_growler
github.com/midas/g_flash_growler/tree/master
DESCRIPTION:
A Guilded (github.com/midas/guilded/tree/master) component that displays Rails flash messages in an interface similar to OS/X’s growler.
FEATURES:
Looks for flash messages in flash, flash and flash and displays a message that will slide out of view if JavaScript is enabled.
COMPATABILITY:
-
Ruby 1.8
-
Rails 2
-
Rails 3
INSTALL:
Configure the Gem for use:
gem 'g_flash_growler', '1.0.7' # Rails 3
config.gem 'g_flash_growler', :version => '1.0.7' # Rails 2
Install the Gem:
bundle install # Rails 3
rake gems:install # Rails 2
gem install g_flash_growler # Manual
Run the assets generator:
rails generate flash_growler # Rails 3
script/generate flash_growler_assets_generator # Rails 2
USE:
Call the flash growler helper somewhere in your view(s). I usually call it in the application layout (or another layout):
<%= raw( g_flash_growler( :id => 'growler', :position => 'bottom' ) ) %> # Rails 3
<%= g_flash_growler( :id => 'growler', :position => 'bottom' ) %> # Rails 2
Also, as with all Guilded components, a call to the apply behavior helper. It also makes the most sense to do this in your layout(s):
<%= raw g_apply_behavior %> # Rails 3
<%= g_apply_behavior %> # Rails 2
To map differently keyed flash messages into one of the flash growler’s:
<%= g_flash_growler( :id => 'growler', :position => 'bottom', :mappings => { :alert => :warning } ) %>
This will map flash to flash so that flash growler will react to the message.
OPTIONS:
-
:position - ‘top’ to display the message at the top of the browser or ‘bottom’ to display message at the bottom (defaults to bottom).
-
:delay - Number of milliseconds to display the message before starting the slide out of view (defaults to 4000 ms).
-
:speed - Number of milliseconds to animate the slide out of view (defaults to 1000 ms).
REQUIREMENTS:
-
Rails >= 2.2.0
-
guilded >= 1.0.0 (github.com/midas/guilded/tree/master)
-
jQuery 1.3.2 (included with midas-guilded)
-
jquery-growler-0.1.js
LICENSE:
(The MIT License)
Copyright © 2009 C. Jason Harrelson (midas)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.