mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 18:21:04 +08:00
21 lines
611 B
JavaScript
21 lines
611 B
JavaScript
(function() {
|
|
'use strict';
|
|
|
|
$('.btn-more-notifications')
|
|
.on('ajax:success', function(e, data) {
|
|
var list = $('.notifications-list');
|
|
var moreBtn = $('.btn-more-notifications');
|
|
if (data.html) {
|
|
// Remove button if all notifications are shown
|
|
if (data.results_number < data.per_page) {
|
|
moreBtn.remove();
|
|
// Otherwise update reference
|
|
} else {
|
|
moreBtn.attr('href', data.more_notifications_url);
|
|
}
|
|
$(list).append(data.html);
|
|
} else if (data.results_number < 1) {
|
|
moreBtn.remove();
|
|
}
|
|
});
|
|
}());
|