README.md in bootstrap_flash_messages-0.0.6 vs README.md in bootstrap_flash_messages-0.0.7
- old
+ new
@@ -1,8 +1,8 @@
# bootstrap_flash_messages
- version 0.0.6
+ version 0.0.7
Robin Brouwer
45north
Bootstrap alerts and Rails flash messages combined in one easy-to-use gem.
@@ -20,10 +20,14 @@
And that's it!
## Changes
+Version 0.0.7 changes (26/01/2013):
+
+ - Added alert_class_mapping (documentation below).
+
Version 0.0.6 changes (27/09/2012):
- Added pull request #5 by protolif. This adds the :fade option.
Version 0.0.5 changes (24/09/2012):
@@ -158,9 +162,39 @@
Inside `flash.en.yml` you can do the following:
success: "Welcome, %{name}."
info: "Your e-mail address has been changed to: %{email}."
+## alert_class_mapping
+
+You can map the keys used inside the flash messages to a different alert class. There are 4 different classes for the alert messages inside bootstrap:
+
+ alert-success
+ alert-info
+ alert-warning
+ alert-error
+
+When you use `:notice` the alert class is mapped (by default) to `alert-success`. So it looks like this:
+
+ :notice maps to "alert-success"
+ :success maps to "alert-success"
+ :info maps to "alert-info"
+ :warning maps to "alert-warning"
+ :error maps to "alert-error"
+
+Changing the mapping is quite easy. Create an initializer (config/initializers/bootstrap_flash_messages.rb) and add the following:
+
+ module BootstrapFlashMessages
+ @alert_class_mapping = {
+ :notice => :error,
+ :success => :success,
+ :info => :info,
+ :warning => :warning,
+ :error => :error
+ }
+ end
+
+Now you can map whatever alert class you want to the different keys.
## Why I created this gem
I created the [gritter gem](https://github.com/RobinBrouwer/gritter) and used it in a lot of projects.
I started using Twitter Bootstrap and really liked the alerts. I loved the way gritter allowed you to set messages
\ No newline at end of file