Skip to content

Instantly share code, notes, and snippets.

@sshaw
Last active July 27, 2016 23:17
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 sshaw/bc27941c20f0adbfa5b5c9c57da095d7 to your computer and use it in GitHub Desktop.
Save sshaw/bc27941c20f0adbfa5b5c9c57da095d7 to your computer and use it in GitHub Desktop.
Ruby helper to render Bourbon/Neat Refills style flash messages
# Helper to render Bourbon/Neat Refills style flash messages
# https://gist.github.com/sshaw/bc27941c20f0adbfa5b5c9c57da095d7
module RefillsFlash
FLASH_KEYS = [:success, :notice, :error, :alert]
def flash_messages
FLASH_KEYS.inject("") do |html, name|
if flash[name]
html << content_tag(:div, :class => "flash-#{name}") {
content_tag :span, flash[name]
}
end
html
end.html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment