Created
July 13, 2012 21:19
-
-
Save taylorbrooks/3107549 to your computer and use it in GitHub Desktop.
Error Messages Helper for Bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/helpers/application_helper.rb | |
def twitterized_type(type) | |
case type | |
when :alert | |
"alert-block" | |
when :error | |
"alert-error" | |
when :notice | |
"alert-info" | |
when :success | |
"alert-success" | |
else | |
type.to_s | |
end | |
end |
If you're using HAML, make sure your flash is referencing the twitterized_type in the class.
1 - flash.each do |type, message|
2 .alert.fade.in{ "data-alert" => "alert", :class => twitterized_type(type) }
3 %a.close{href: "#", data: {dismiss: 'alert'}} ×
4 %h4= message
Pardon me for the curt and improper english; Twenty hour coding sessions, 64oz of coffee, and an over heating laptop does not make for a very good combination.
Thanks for showing me the HAML code, might help on another app. But, in all actuality, I was using ERB.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oddely enough my views do now find this, how do we fix?