gitlab-org--gitlab-foss/app/assets/javascripts/activities.js.es6

38 lines
953 B
JavaScript
Raw Normal View History

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