diff --git a/combo/public/static/js/combo.public.js b/combo/public/static/js/combo.public.js index 9e61e788..1e6a8702 100644 --- a/combo/public/static/js/combo.public.js +++ b/combo/public/static/js/combo.public.js @@ -252,4 +252,27 @@ $(function() { }).focusout(function() { $('body').removeClass('focus-in'); }); + + /* notifications */ + $('div.cell li.combo-notification').on('click', function(event) { + var target_url = $(this).find('a').attr('href'); + if ($(this).hasClass('combo-notification-acked')) { + if (target_url != '#') { + window.location.href = target_url; + } + } else { + var ack_url = $('body').data('api-root') + 'notification/ack/' + $(this).data('combo-notification-id'); + $.ajax({ + url: ack_url, + success: function(html) { + $(this).addClass('combo-notification-acked'); + if (target_url != '#') { + window.location.href = target_url; + } + } + }); + } + return false; + }); + });