diff --git a/public/src/forum/notifications.js b/public/src/forum/notifications.js index 38bb3c80a2..de1e053871 100644 --- a/public/src/forum/notifications.js +++ b/public/src/forum/notifications.js @@ -2,7 +2,8 @@ define(function() { var Notifications = {}; Notifications.init = function() { - var listEl = $('.notifications-list'); + var listEl = $('.notifications-list'), + markAllReadEl = document.getElementById('mark-all-notifs-read'); $('span.timeago').timeago(); @@ -10,6 +11,20 @@ define(function() { listEl.on('click', 'li', function(e) { this.querySelector('a').click(); }); + + // Mark all as read button + $(markAllReadEl).click(function() { + socket.emit('api:notifications.mark_all_read', {}, function() { + ajaxify.go('notifications'); + app.alert({ + alert_id: "notifications:mark_all_read", + title: "All Notifications Read", + message: "Successfully marked all notifications read", + type: 'success', + timeout: 2500 + }) + }); + }); } return Notifications; diff --git a/public/templates/notifications.tpl b/public/templates/notifications.tpl index d509293009..beac732ef1 100644 --- a/public/templates/notifications.tpl +++ b/public/templates/notifications.tpl @@ -1,10 +1,10 @@

[[notifications:title]]

- +