Skip to content

Instantly share code, notes, and snippets.

@ryanahamilton
Created December 16, 2008 15:13
Show Gist options
  • Save ryanahamilton/36626 to your computer and use it in GitHub Desktop.
Save ryanahamilton/36626 to your computer and use it in GitHub Desktop.
Pretty flash errors and notices that fade
#notice {
border: solid 1px #99cc99;
background-color: #e2f9e3;
color: #006600;
padding: 5px;
margin-bottom: 5px;
}
#notice.error {
border-color: #cc0000;
background-color: #eeaaaa;
color: #cc0000;
}
<% if flash[:error] || flash[:notice] %>
<%= content_tag :div, flash[:error] || flash[:notice], :id => 'notice', :class => ('error' if flash[:error]) %>
<script type="text/javascript">
setTimeout("new Effect.Fade('notice');", 1000)
</script>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment