I would like to create a Notification Bar similar to Facebook or StackExchange.
I want it to display notifications with numbers and a drop down panel with some information.
Can someone provide an example or a tutorial on how to create that in Ruby on Rails or Javascript/jQuery?
Thanks
It's probably done as a two stage process:
The first part is simple, you just call a method on your association if you have a scope established:
<%= link_to(@user.notifications.unread.count, user_notifications_path(@user), :class => 'notifications') %>
The next part involves patching together something with jQuery, perhaps like this:
$('.notifications').click(function() {
$('#notifications').load(this.href);
return false;
});
You'll need to have a specific view that will render into that #notification
block.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With