2016-11-20 00:52:53 -05:00
|
|
|
/* eslint-disable no-param-reassign, class-methods-use-this */
|
2016-11-21 18:19:51 -05:00
|
|
|
/* global Pager */
|
|
|
|
/* global Cookies */
|
2016-11-20 00:52:53 -05:00
|
|
|
|
|
|
|
((global) => {
|
|
|
|
class Activities {
|
|
|
|
constructor() {
|
2016-07-24 16:45:11 -04:00
|
|
|
Pager.init(20, true, false, this.updateTooltips);
|
2016-11-21 11:17:11 -05:00
|
|
|
$('.event-filter-link').on('click', (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
this.toggleFilter(e.currentTarget);
|
2016-11-20 00:52:53 -05:00
|
|
|
this.reloadActivities();
|
|
|
|
});
|
2016-07-24 16:45:11 -04:00
|
|
|
}
|
|
|
|
|
2016-11-20 00:52:53 -05:00
|
|
|
updateTooltips() {
|
2016-09-08 14:57:24 -04:00
|
|
|
gl.utils.localTimeAgo($('.js-timeago', '.content_list'));
|
2016-11-20 00:52:53 -05:00
|
|
|
}
|
2016-07-24 16:45:11 -04:00
|
|
|
|
2016-11-20 00:52:53 -05:00
|
|
|
reloadActivities() {
|
|
|
|
$('.content_list').html('');
|
2016-09-08 14:57:24 -04:00
|
|
|
Pager.init(20, true, false, this.updateTooltips);
|
2016-11-20 00:52:53 -05:00
|
|
|
}
|
2016-08-29 13:09:33 -04:00
|
|
|
|
2016-11-20 00:52:53 -05:00
|
|
|
toggleFilter(sender) {
|
2016-11-21 11:17:11 -05:00
|
|
|
const $sender = $(sender);
|
|
|
|
const filter = $sender.attr('id').split('_')[0];
|
2016-07-24 16:45:11 -04:00
|
|
|
|
2016-11-20 00:52:53 -05:00
|
|
|
$('.event-filter .active').removeClass('active');
|
|
|
|
Cookies.set('event_filter', filter);
|
2016-07-24 16:45:11 -04:00
|
|
|
|
2016-11-21 11:17:11 -05:00
|
|
|
$sender.closest('li').toggleClass('active');
|
2016-11-20 00:52:53 -05:00
|
|
|
}
|
|
|
|
}
|
2016-07-24 16:45:11 -04:00
|
|
|
|
2016-11-20 00:52:53 -05:00
|
|
|
global.Activities = Activities;
|
|
|
|
})(window.gl || (window.gl = {}));
|