1
0
Fork 0

main.js: set notifications icon "on" with new unread notifcations. Show "Nothing new here" with no notifications at all

This commit is contained in:
Fabio Comuni 2012-04-12 09:15:08 +02:00
parent 18ecac4e93
commit a23d46c49b

View file

@ -137,13 +137,12 @@
$('#mail-update-li').html(mail); $('#mail-update-li').html(mail);
var eNotif = $(data).find('notif') var eNotif = $(data).find('notif')
notif = eNotif.attr('count');
if (notif>=0){ if (eNotif.children("note").length==0){
$("#nav-notifications-linkmenu").addClass("on"); $("#nav-notifications-menu").html(notifications_empty);
} else {
nnm = $("#nav-notifications-menu"); nnm = $("#nav-notifications-menu");
nnm.html(notifications_all + notifications_mark); nnm.html(notifications_all + notifications_mark);
//nnm.attr('popup','true'); //nnm.attr('popup','true');
eNotif.children("note").each(function(){ eNotif.children("note").each(function(){
e = $(this); e = $(this);
@ -151,10 +150,12 @@
html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen')); html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen'));
nnm.append(html); nnm.append(html);
}); });
}
notif = eNotif.attr('count');
if (notif>0){
$("#nav-notifications-linkmenu").addClass("on");
} else { } else {
// $("#nav-notifications-linkmenu").removeClass("on"); $("#nav-notifications-linkmenu").removeClass("on");
// $("#nav-notifications-menu").html(notifications_empty);
} }
if(notif == 0) { notif = ''; $('#notify-update').removeClass('show') } else { $('#notify-update').addClass('show') } if(notif == 0) { notif = ''; $('#notify-update').removeClass('show') } else { $('#notify-update').addClass('show') }
$('#notify-update').html(notif); $('#notify-update').html(notif);
@ -609,4 +610,4 @@ function previewTheme(elm) {
$('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>'); $('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>');
}); });
} }