Skip to content

Instantly share code, notes, and snippets.

@jackcallister
Created April 15, 2013 23:34
Show Gist options
  • Save jackcallister/5392179 to your computer and use it in GitHub Desktop.
Save jackcallister/5392179 to your computer and use it in GitHub Desktop.
Twitter Bootstrap flash partial for Rails
<% [: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">&times;</a>
<%= flash[level] %>
</div>
<% end %>
<% end %>
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