if i am using the devise gem with rails, how do i make the flash messages appear only when theres content inside of it.
does rails have an easy way to do this or do i manually need to do it in jquery?
currently im using twitter bootstrap v2 and it has them built in by default. here is the best jquery i could come up with by the way, im not sure how this could be refactored better (although i definitely know it could be). I had to do it like this because i have an 'x' inside the <p>
flash
if($('.alert-success').clone().children().remove().end().text() != "") {
$('.alert-success').fadeIn();
}
if($('.alert-error').clone().children().remove().end().text() != "") {
$('.alert-error').fadeIn();
}
EDIT: My layout contains:
<p class="alert alert-success"><a class="close" data-dismiss="alert">×</a><%= notice %></p>
<p class="alert alert-error"><a class="close" data-dismiss="alert">×</a><%= alert %></p>
×<%= alert %>
– Tallboy Feb 24 '12 at 10:21×<%= notice %>
` only `if` there's some content in `notice`? – Gareth Feb 24 '12 at 10:31