Skip to content

Instantly share code, notes, and snippets.

Created May 7, 2013 00:25
Show Gist options
  • Save anonymous/5529397 to your computer and use it in GitHub Desktop.
Save anonymous/5529397 to your computer and use it in GitHub Desktop.
<%= display_messages %>
# returns {:error=>"Email/senha incorretos."}
def display_messages
flash.each do |name, message|
if message.is_a?(String)
case name
when :error
text = "#b94a48"
when :warning
text = "#c09853"
when :success
text = "#468847"
when :info
text = "#3a87ad"
else
text = "white"
end
html = <<-HTML
<div class="alert alert-error alert-block">
<i class="icon-remove icon-large"></i>
#{message}
</div>
HTML
html.html_safe
end
end
end
# returns " <div class=\"alert alert-error alert-block\">\n <i class=\"icon-remove icon-large\"></i>\n Email/senha incorretos.\n </div>\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment