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