public
Description: Rails plugin: provides reusable (and pretty) flash messages.
Homepage: http://rpheath.com/posts/379-rails-plugin-for-pretty-flash-messages
Clone URL: git://github.com/rpheath/pretty_flash.git
name age message
file .gitignore Fri Jan 02 07:31:16 -0800 2009 added .gitignore [rpheath]
file MIT-LICENSE Tue Dec 30 09:12:25 -0800 2008 initial commit [rpheath]
file README.textile Tue Dec 30 09:12:25 -0800 2008 initial commit [rpheath]
file Rakefile Tue Dec 30 09:12:25 -0800 2008 initial commit [rpheath]
directory assets/ Fri Jan 02 07:31:02 -0800 2009 slight attempt to prevent file collisions [rpheath]
file init.rb Tue Dec 30 09:12:25 -0800 2008 initial commit [rpheath]
file install.rb Tue Dec 30 09:31:12 -0800 2008 added installation instructions [rpheath]
directory lib/ Tue Mar 10 08:45:56 -0700 2009 support flash.now type of messages [rpheath]
directory tasks/ Fri Jan 02 07:35:16 -0800 2009 whoooops [rpheath]
directory test/ Tue Dec 30 09:12:25 -0800 2008 initial commit [rpheath]
file uninstall.rb Tue Dec 30 09:12:25 -0800 2008 initial commit [rpheath]
README.textile

PrettyFlash

Rails plugin that provides “pretty” flash messages.

In the controller…

This plugin gives a couple of convenience methods for setting flash messages.

notice "Hooray! You did something good."
warning "Uhm, You're not allowed to do that yet."
error "Ooooops! Something went wrong."

Use those instead of the typical flash[:notice] = "Some String" (all it does is set that for you).

In the view…

Then all you have to do to display them is:

<%= display_flash_messages %>

Easy enough?

Get Started

There’s an assets folder with this plugin, that contains the images, CSS, and javascript (optional). There’s
a rake task that installs this stuff where it needs to be (inside the public/ directory).

$ rake pretty_flash:install

WARNING: this will overwrite any of the files that have the same name. So double check if you don’t want that to happen.

Also, the flash.js file located in the assets/javascripts folder is only used to fade the flash messages after so many
seconds (defaults to 25 seconds). If you want that, I’ve provide support for prototype and jquery, so just copy whichever
one you’re using into application.js and you’re all set. If you’re not using either, sorry :-)

Enjoy!

Licensing

Copyright © 2008 Ryan Heath, released under the MIT license