Skip to content

Instantly share code, notes, and snippets.

@MartinHeimbring
Created February 15, 2015 11:16
Show Gist options
  • Select an option

  • Save MartinHeimbring/b05fb7ff80abf09fab53 to your computer and use it in GitHub Desktop.

Select an option

Save MartinHeimbring/b05fb7ff80abf09fab53 to your computer and use it in GitHub Desktop.
associate right bootstrap class with flash key
- flash.each do |type, message|
%div{ class: "alert #{bootstrap_class_for(type)}" }
%button.close{ :data => { :dismiss => "alert" } } x
= message
# From application helper
def bootstrap_class_for flash_type
case flash_type.to_sym
when :success
"alert-success"
when :error
"alert-error"
when :alert
"alert-danger"
when :notice
"alert-info"
else
flash_type.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment