Skip to content

Instantly share code, notes, and snippets.

@erithair
Forked from roberto/_flash_messages.html.erb
Last active August 29, 2015 14:24
Show Gist options
  • Save erithair/62c0fb7e799ad4118598 to your computer and use it in GitHub Desktop.
Save erithair/62c0fb7e799ad4118598 to your computer and use it in GitHub Desktop.
<% flash.each do |type, message| %>
<div class="alert <%= alert_class_for(type) %> alert-dismissible fade in">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<%= message %>
</div>
<% end %>
<%= render partial: "shared/flash_messages", flash: flash %>
module ApplicationHelper
def alert_class_for(flash_type)
{
:success => 'alert-success',
:error => 'alert-danger',
:alert => 'alert-warning',
:notice => 'alert-info'
}[flash_type.to_sym] || flash_type.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment