views/layouts/application.html.erb:-
<div class="FlashNotice">
<% flash.each do |key, value| %>
<div class="<%= flash_class(key) %> fade in">
<a href="#" data-dismiss="alert" class="close">×</a>
<%= value %>
</div>
<% end %>
</div>
<style>
.FlashNotice .alert{
margin-bottom: 0px;
}
</style>
application_helper.rb:-
def flash_class(level)
case level
when 'notice' then "alert alert-info"
when 'success' then "alert alert-success"
when 'error' then "alert alert-error"
when 'alert' then "alert alert-error"
end
end
application.js:-
setTimeout(function() {
$('.FlashNotice').fadeOut('fast');
}, 5000);
No comments:
Post a Comment