scinote-web/app/assets/javascripts/my_modules/activities.js
2016-02-12 16:52:43 +01:00

16 lines
483 B
JavaScript

// Show more activities link.
$(".btn-more-activities")
.on("ajax:success", function (e, data) {
if (data.html) {
var list = $("#list-activities");
var moreBtn = $(".btn-more-activities");
// Remove button if all activities are shown
if (data.results_number < data.per_page) {
moreBtn.remove();
// Otherwise update reference
} else {
moreBtn.attr("href", data.more_url);
}
$(list).append(data.html);
}
});