Skip to content

artur79/sexy_flash

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SexyFlash
=========

This plugin provides an easy to use helper to display flash messages. It provides styling for flash messages, and JQuery UI effects for extra sexiness.

Requires
========
 * JQuery
 * JQuery UI
 
You can install both of these into your Rails project from https://github.com/rails/jquery-ujs. JQuery will be the default Rails JS library in 3.1.

Example
=======
Add the stylesheet in your layout:

<%= stylesheet_link_tag "sexy_flash" %>

Use flash notice, warning and error as you normally would. Then simply call the helper from your view:

<%= sexy_flash %>

Options
=======

The sexy_flash helper accepts an options hash which overrides the defaults. For example:

<%= sexy_flash :timeout => 2000, :duration => 1000, :show_effect => "fade", :hide_effect => "fade" %>

Options are:

 * timeout: in ms, how long the flash will display for.
 * duration: in ms, the duration of the animation that shows and hides the flash
 * show_effect and hide_effect: the JQuery UI animation effect to use when hiding and showing the flash. The valid effects are the JQuery UI effects: 'fade', 'blind', 'clip', 'drop', 'explode', 'fold', 'puff', 'slide', 'scale', 'size', 'pulsate'.

In addition, sometimes you would want to specify flash message options upon creation. You may specify options on your controller, which will override any options you've specified on the sexy_flash helper call in your view. For example:

flash[:error] = 'Dude, you screwed up!', {:timeout => 0} # Don't hide the flash message.

Contributors
============

  * Akhil Bansal (http://webonrails.com): created global options functionality on the sexy_flash view helper.
  * Richard Luther (http://github.com/tangofoxtrot): Bug fix on install script
  * Artur79 (http://github.com/artur79): Rails 3 fixes, initial migration to JQuery
  * James Kahn (http://github.com/jisk): Migration to JQuery UI, documentation cleanup

Licence
=======

Copyright (c) 2008-2009 Harold A. Gimenez, released under the MIT license.

About

Sexy flash messages helper for Rails applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%