Skip to content

Instantly share code, notes, and snippets.

@aravindgd
Created October 6, 2014 13:46
Show Gist options
  • Save aravindgd/9b46f8cdf4aff189c736 to your computer and use it in GitHub Desktop.
Save aravindgd/9b46f8cdf4aff189c736 to your computer and use it in GitHub Desktop.
module ApplicationHelper
def bootstrap_class_for(flash_type)
case flash_type
when "success"
"alert-success" # Green
when "error"
"alert-danger" # Red
when "alert"
"alert-warning" # Yellow
when "notice"
"alert-info" # Blue
else
flash_type.to_s
end
end
end
@aravindgd
Copy link
Author

  • flash.each do |type, message|
    %div{:class => "alert #{bootstrap_class_for(type)} alert-dismissable fade in"}
    %button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
    = message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment