notifications: ack on click (#34244)

This commit is contained in:
Frédéric Péters 2019-06-23 13:20:55 +02:00
parent 26589e80a1
commit 167dbc1617
1 changed files with 23 additions and 0 deletions

View File

@ -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;
});
});