Skip to content

Instantly share code, notes, and snippets.

@pallavsharma
Forked from roberto/_flash_messages.html.erb
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pallavsharma/e5f8d19ecac5119efd2f to your computer and use it in GitHub Desktop.
Save pallavsharma/e5f8d19ecac5119efd2f to your computer and use it in GitHub Desktop.
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
<%= render partial: "shared/flash_messages", flash: flash %>
module ApplicationHelper
def bootstrap_class_for flash_type
case flash_type
when :success
"alert-success"
when :error
"alert-error"
when :alert
"alert-block"
when :notice
"alert-info"
else
flash_type.to_s
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment