debian-mirror-gitlab/app/assets/javascripts/activities.js

39 lines
1 KiB
JavaScript
Raw Normal View History

2016-09-13 17:45:13 +05:30
(function() {
this.Activities = (function() {
function Activities() {
Pager.init(20, true, false, this.updateTooltips);
$(".event-filter-link").on("click", (function(_this) {
return function(event) {
event.preventDefault();
_this.toggleFilter($(event.currentTarget));
return _this.reloadActivities();
};
})(this));
}
Activities.prototype.updateTooltips = function() {
2016-09-29 09:46:39 +05:30
return gl.utils.localTimeAgo($('.js-timeago', '.content_list'));
2016-09-13 17:45:13 +05:30
};
Activities.prototype.reloadActivities = function() {
$(".content_list").html('');
return Pager.init(20, true);
};
Activities.prototype.toggleFilter = function(sender) {
2016-11-03 12:29:30 +05:30
var filter = sender.attr("id").split("_")[0];
2016-09-13 17:45:13 +05:30
$('.event-filter .active').removeClass("active");
2016-11-03 12:29:30 +05:30
$.cookie("event_filter", filter, {
2016-09-29 09:46:39 +05:30
path: gon.relative_url_root || '/'
2016-09-13 17:45:13 +05:30
});
2016-11-03 12:29:30 +05:30
sender.closest('li').toggleClass("active");
2016-09-13 17:45:13 +05:30
};
return Activities;
})();
}).call(this);