Skip to content
Snippets Groups Projects
Commit ed88515d authored by Mike Greiling's avatar Mike Greiling
Browse files

convert activities.js to es6 class syntax

parent 171ece8f
No related branches found
No related tags found
No related merge requests found
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-undef, quotes, no-var, padded-blocks, max-len */
(function() {
this.Activities = (function() {
function Activities() {
/* eslint-disable no-param-reassign, class-methods-use-this */
/* global Pager, Cookies */
((global) => {
class Activities {
constructor() {
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));
$('.event-filter-link').on('click', (event) => {
event.preventDefault();
this.toggleFilter($(event.currentTarget));
this.reloadActivities();
});
}
 
Activities.prototype.updateTooltips = function() {
updateTooltips() {
gl.utils.localTimeAgo($('.js-timeago', '.content_list'));
};
}
 
Activities.prototype.reloadActivities = function() {
$(".content_list").html('');
reloadActivities() {
$('.content_list').html('');
Pager.init(20, true, false, this.updateTooltips);
};
Activities.prototype.toggleFilter = function(sender) {
var filter = sender.attr("id").split("_")[0];
$('.event-filter .active').removeClass("active");
Cookies.set("event_filter", filter);
}
 
sender.closest('li').toggleClass("active");
};
toggleFilter(sender) {
const filter = sender.attr('id').split('_')[0];
 
return Activities;
$('.event-filter .active').removeClass('active');
Cookies.set('event_filter', filter);
 
})();
sender.closest('li').toggleClass('active');
}
}
 
}).call(this);
global.Activities = Activities;
})(window.gl || (window.gl = {}));
Loading
Loading
@@ -110,10 +110,10 @@
Issuable.init();
break;
case 'dashboard:activity':
new Activities();
new gl.Activities();
break;
case 'dashboard:projects:starred':
new Activities();
new gl.Activities();
break;
case 'projects:commit:show':
new Commit();
Loading
Loading
@@ -139,7 +139,7 @@
new gl.Pipelines();
break;
case 'groups:activity':
new Activities();
new gl.Activities();
break;
case 'groups:show':
shortcut_handler = new ShortcutsNavigation();
Loading
Loading
Loading
Loading
@@ -134,7 +134,7 @@ content on the Users#show page.
}
const $calendarWrap = this.$parentEl.find('.user-calendar');
$calendarWrap.load($calendarWrap.data('href'));
new Activities();
new gl.Activities();
return this.loaded['activity'] = true;
}
 
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@
= spinner
 
:javascript
var activity = new Activities();
var activity = new gl.Activities();
$(document).on('page:restore', function (event) {
activity.reloadActivities()
})
Loading
Loading
@@ -35,7 +35,7 @@
describe('Activities', () => {
beforeEach(() => {
fixture.load(fixtureTemplate);
new Activities();
new gl.Activities();
});
 
for(let i = 0; i < filters.length; i++) {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment