Last active
February 15, 2016 05:54
-
-
Save BideoWego/9e8b6626fdcb77267377 to your computer and use it in GitHub Desktop.
Rails flash partial with Bootstrap classes
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
<% unless flash.empty? %> | |
<% flash.each do |key, value| %> | |
<div class="main-flash alert alert-<%= flash_css_class(key) %> text-center" style="border-radius: 0;"> | |
<%= value %> | |
</div> | |
<% end %> | |
<% end %> | |
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
module ApplicationHelper | |
def flash_css_class(key) | |
if ['notice', 'error'].include?(key) | |
key == 'notice' ? 'info' : 'danger' | |
else | |
key.to_s | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment