2016-07-24 16:45:11 -04:00
|
|
|
(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-08-18 12:18:25 -04:00
|
|
|
return gl.utils.localTimeAgo($('.js-timeago', '.content_list'));
|
2016-07-24 16:45:11 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
Activities.prototype.reloadActivities = function() {
|
|
|
|
$(".content_list").html('');
|
|
|
|
return Pager.init(20, true);
|
|
|
|
};
|
|
|
|
|
|
|
|
Activities.prototype.toggleFilter = function(sender) {
|
2016-08-29 13:09:33 -04:00
|
|
|
var filter = sender.attr("id").split("_")[0];
|
|
|
|
|
2016-07-24 16:45:11 -04:00
|
|
|
$('.event-filter .active').removeClass("active");
|
2016-08-29 13:09:33 -04:00
|
|
|
$.cookie("event_filter", filter, {
|
2016-08-02 11:16:41 -04:00
|
|
|
path: gon.relative_url_root || '/'
|
2016-07-24 16:45:11 -04:00
|
|
|
});
|
2016-08-29 13:09:33 -04:00
|
|
|
|
|
|
|
sender.closest('li').toggleClass("active");
|
2016-07-24 16:45:11 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
return Activities;
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
}).call(this);
|