2016-08-05 12:34:10 -07:00
|
|
|
|
define(['jQuery'], function ($) {
|
2016-10-22 22:11:46 -07:00
|
|
|
|
'use strict';
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
$(document).on("pageshow", "#notificationsPage", function () {
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
2014-05-29 21:16:11 -07:00
|
|
|
|
// If there is no user logged in there can be no notifications
|
|
|
|
|
if (!Dashboard.getCurrentUserId()) return;
|
2015-05-31 14:07:44 -07:00
|
|
|
|
|
2014-05-26 21:29:35 -07:00
|
|
|
|
var elem = $(".notificationsList");
|
|
|
|
|
var startIndex = 0;
|
|
|
|
|
var limit = 10;
|
|
|
|
|
|
2015-05-31 14:07:44 -07:00
|
|
|
|
Notifications.showNotificationsList(startIndex, limit, elem);
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
2014-05-27 07:30:21 -07:00
|
|
|
|
elem.on("click", ".btnPreviousPage", function (e) {
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
2014-05-27 07:30:21 -07:00
|
|
|
|
e.preventDefault();
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
2014-05-27 07:30:21 -07:00
|
|
|
|
startIndex = startIndex - limit;
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
2014-05-27 07:30:21 -07:00
|
|
|
|
if (startIndex < 0) startIndex = 0;
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
2015-05-31 14:07:44 -07:00
|
|
|
|
Notifications.showNotificationsList(startIndex, limit, elem);
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
2016-08-05 12:34:10 -07:00
|
|
|
|
}).on("click", ".btnNextPage", function (e) {
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
startIndex = startIndex + limit;
|
|
|
|
|
|
2015-05-31 14:07:44 -07:00
|
|
|
|
Notifications.showNotificationsList(startIndex, limit, elem);
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2015-05-31 14:07:44 -07:00
|
|
|
|
Notifications.markNotificationsRead([]);
|
2014-05-26 21:29:35 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2016-08-05 12:34:10 -07:00
|
|
|
|
});
|