scinote-web/app/assets/javascripts/sitewide/counter_badge.js
2017-05-08 17:32:55 +02:00

22 lines
464 B
JavaScript

var CounterBadge = (function() {
'use strict';
function updateCounterBadge(count, linkedId, type) {
var badge =
$('.' + type +
'-badge-indicator[data-linked-id="' +
linkedId + '"]').first();
if (badge.length) {
badge.html(count);
if (count > 0) {
badge.removeClass('hidden');
} else {
badge.addClass('hidden');
}
}
}
return {
updateCounterBadge: updateCounterBadge
};
})();