Created
April 15, 2013 23:34
-
-
Save jackcallister/5392179 to your computer and use it in GitHub Desktop.
Twitter Bootstrap flash partial for Rails
This file contains hidden or 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
<% [:notice, :error, :alert, :success].each do |level| %> | |
<% unless flash[level].blank? %> | |
<div class="alert alert-<%= flash_class(level) %>"> | |
<a class="close" href="#" data-dismiss="alert">×</a> | |
<%= flash[level] %> | |
</div> | |
<% end %> | |
<% end %> |
This file contains hidden or 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_class(level) | |
case level | |
when :success then "success" | |
when :notice then "info" | |
when :error then "error" | |
when :alert then "warning" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment