Created
February 8, 2013 15:23
-
-
Save robotmay/4739676 to your computer and use it in GitHub Desktop.
Example of how to hide flash messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
def create | |
flash[:alert] = "You created a thing!" | |
redirect_to "/somepath" | |
end | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<div id="flash-messages"> | |
<% flash.each do |type, message| %> | |
<div class="<%= type %>"> | |
<%= message %> | |
</div> | |
<% end %> | |
</div> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$("#flash-messages div").delay(5000).slideUp(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment