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

39 lines
927 B
JavaScript
Raw Normal View History

2017-08-17 22:00:37 +05:30
/* eslint-disable no-param-reassign, class-methods-use-this */
/* global Pager */
import Cookies from 'js-cookie';
class Activities {
constructor() {
2017-09-10 17:25:29 +05:30
Pager.init(20, true, false, data => data, this.updateTooltips);
2017-08-17 22:00:37 +05:30
$('.event-filter-link').on('click', (e) => {
e.preventDefault();
this.toggleFilter(e.currentTarget);
this.reloadActivities();
});
}
updateTooltips() {
gl.utils.localTimeAgo($('.js-timeago', '.content_list'));
}
reloadActivities() {
$('.content_list').html('');
2017-09-10 17:25:29 +05:30
Pager.init(20, true, false, data => data, this.updateTooltips);
2017-08-17 22:00:37 +05:30
}
toggleFilter(sender) {
const $sender = $(sender);
const filter = $sender.attr('id').split('_')[0];
$('.event-filter .active').removeClass('active');
Cookies.set('event_filter', filter);
$sender.closest('li').toggleClass('active');
}
}
window.gl = window.gl || {};
window.gl.Activities = Activities;