This commit is contained in:
Baris Soner Usakli
2014-02-18 15:46:03 -05:00
parent 6140d76f76
commit 8518f26adb

View File

@@ -17,7 +17,7 @@ define(function() {
numUnread = data.unread.length, numUnread = data.unread.length,
x; x;
notifList.html(''); var html = '';
if (!err && (data.read.length + data.unread.length) > 0) { if (!err && (data.read.length + data.unread.length) > 0) {
var image = ''; var image = '';
@@ -27,7 +27,7 @@ define(function() {
} else { } else {
image = ''; image = '';
} }
notifList.append($('<li class="' + (data.unread[x].readClass || '') + '"><a href="' + data.unread[x].path + '">' + image + '<span class="pull-right relTime">' + utils.relativeTime(data.unread[x].datetime, true) + '</span><span class="text">' + data.unread[x].text + '</span></a></li>')); html += '<li class="' + (data.unread[x].readClass || '') + '"><a href="' + data.unread[x].path + '">' + image + '<span class="pull-right relTime">' + utils.relativeTime(data.unread[x].datetime, true) + '</span><span class="text">' + data.unread[x].text + '</span></a></li>';
} }
for (x = 0; x < numRead; x++) { for (x = 0; x < numRead; x++) {
@@ -36,18 +36,27 @@ define(function() {
} else { } else {
image = ''; image = '';
} }
notifList.append($('<li class="' + data.read[x].readClass + '"><a href="' + data.read[x].path + '">' + image + '<span class="pull-right relTime">' + utils.relativeTime(data.read[x].datetime, true) + '</span><span class="text">' + data.read[x].text + '</span></a></li>')); html += '<li class="' + data.read[x].readClass + '"><a href="' + data.read[x].path + '">' + image + '<span class="pull-right relTime">' + utils.relativeTime(data.read[x].datetime, true) + '</span><span class="text">' + data.read[x].text + '</span></a></li>';
} }
addSeeAllLink(replaceHtml);
} else { } else {
translator.translate('<li class="no-notifs"><a>[[notifications:no_notifs]]</a></li>', function(translated) { translator.translate('<li class="no-notifs"><a>[[notifications:no_notifs]]</a></li>', function(translated) {
notifList.append($(translated)); html += translated;
addSeeAllLink(replaceHtml);
}); });
} }
function addSeeAllLink(callback) {
translator.translate('<li class="pagelink"><a href="' + RELATIVE_PATH + '/notifications">[[notifications:see_all]]</a></li>', function(translated) { translator.translate('<li class="pagelink"><a href="' + RELATIVE_PATH + '/notifications">[[notifications:see_all]]</a></li>', function(translated) {
notifList.append($(translated)); html += translated;
callback();
}); });
}
function replaceHtml() {
notifList.html(html);
}
updateNotifCount(data.unread.length); updateNotifCount(data.unread.length);