rework notifications flyout
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
(function ($, document, Notifications) {
|
||||
|
||||
$(document).on("pageinit", "#notificationsPage", function () {
|
||||
$(document).on("pageshowready", "#notificationsPage", function () {
|
||||
|
||||
// If there is no user logged in there can be no notifications
|
||||
if (!Dashboard.getCurrentUserId()) return;
|
||||
|
||||
|
||||
var elem = $(".notificationsList");
|
||||
var btn = $(".btnMarkReadContainer");
|
||||
var startIndex = 0;
|
||||
var limit = 10;
|
||||
|
||||
Notifications.showNotificationsList(startIndex, limit, elem, btn);
|
||||
Notifications.showNotificationsList(startIndex, limit, elem);
|
||||
|
||||
elem.on("click", ".btnPreviousPage", function (e) {
|
||||
|
||||
@@ -20,7 +19,7 @@
|
||||
|
||||
if (startIndex < 0) startIndex = 0;
|
||||
|
||||
Notifications.showNotificationsList(startIndex, limit, elem, btn);
|
||||
Notifications.showNotificationsList(startIndex, limit, elem);
|
||||
|
||||
})
|
||||
.on("click", ".btnNextPage", function (e) {
|
||||
@@ -29,25 +28,11 @@
|
||||
|
||||
startIndex = startIndex + limit;
|
||||
|
||||
Notifications.showNotificationsList(startIndex, limit, elem, btn);
|
||||
Notifications.showNotificationsList(startIndex, limit, elem);
|
||||
|
||||
});
|
||||
|
||||
$(".readOnlyContent").on("click", ".btnMarkRead", function () {
|
||||
|
||||
var ids = $(".notificationsList div").map(function () {
|
||||
|
||||
return this.getAttribute('data-notificationid');
|
||||
|
||||
}).get();
|
||||
|
||||
Notifications.markNotificationsRead(ids, function () {
|
||||
|
||||
Notifications.showNotificationsList(startIndex, limit, elem, btn);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Notifications.markNotificationsRead([]);
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user