Bounga / Flash Helper (http://bitbucket.org/Bounga/flash-helper/)
Ruby on Rails helper that simplify flash messages displaying
$ hg clone http://bitbucket.org/Bounga/flash-helper/
| commit 4: | fbf2804e0e42 |
| parent 3: | d7fb230576db |
| child 5: | aeac7e2b8433 |
NB: This is not the latest revision. For the latest view, go to tip.
| filename | size | last modified | ||
|---|---|---|---|---|
| assets | ||||
| lib | ||||
| tasks | ||||
| test | ||||
| .hgignore | 21 B | 16 months ago | Gemified plugin | |
| CHANGELOG | 22 B | 16 months ago | Gemified plugin | |
| LICENCE | 1.0 KB | 16 months ago | Gemified plugin | |
| README | 1.7 KB | 17 months ago | Updated style | |
| Rakefile | 975 B | 16 months ago | Gemified plugin | |
| init.rb | 132 B | 17 months ago | Initial import | |
| install.rb | 25 B | 17 months ago | Initial import | |
| uninstall.rb | 27 B | 17 months ago | Initial import |
README
--markdown--
FlashHelper
This extension provides a simple way to handle flash messages. You can easily display notices, errors and warnings using the convinience method.
Installation
In your Rails app root, use the following command-line :
cd vendor/plugins
hg clone http://bitbucket.org/Bounga/flash-helper
If you want to install the flash_helper CSS file in your stylesheets directory, use :
rake flash_helper:install
Example
For example, in your layout use :
display_flashes
Then in your controllers you can use :
flash[:notice] = "Successfully created..."
flash[:errors] = "Creation failed!"
flash[:errors] = @news.errors
flash[:warning] = "The new user has no blog associated..."
If you're using Rails >= 2.2, you can translate plugin internal messages. For example in config/locales/fr.yml you can add :
flash_helper:
default_message: "Il y a des problèmes dans le formulaire :"
Tune display_flashes :
Options for flash helpers are optional and get their default values from the Bounga::FlashHelper::ViewHelpers.flash_options hash. You can write to this hash to override default options on the global level:
Bounga::FlashHelper::ViewHelpers.flash_options[:notice_class] = 'my_notice'
Available options (and their defaults) are :
:list_class => 'errors_list'
:notice_class => 'notice'
:errors_class => 'errors'
:warning_class => 'warning'
:default_message => 'There are problems in your submission:'
By putting this into "config/initializers/flash_helper.rb" (or simply environment.rb in older versions of Rails) you can easily override any default option.
Other
More information on Project homepage
Problems, comments, and suggestions are welcome on the ticket system
Copyright (c) 2008 Nicolas Cavigneaux, released under the MIT license
