Commit 97bbf0df authored by Martin Wortschack's avatar Martin Wortschack Committed by Mike Greiling

Resolve "Endless scroll loader is visible on user profile overview page"

parent 22ab1a82
...@@ -6,10 +6,12 @@ import Pager from './pager'; ...@@ -6,10 +6,12 @@ import Pager from './pager';
import { localTimeAgo } from './lib/utils/datetime_utility'; import { localTimeAgo } from './lib/utils/datetime_utility';
export default class Activities { export default class Activities {
constructor() { constructor(container = '') {
Pager.init(20, true, false, data => data, this.updateTooltips); this.container = container;
$('.event-filter-link').on('click', (e) => { Pager.init(20, true, false, data => data, this.updateTooltips, this.container);
$('.event-filter-link').on('click', e => {
e.preventDefault(); e.preventDefault();
this.toggleFilter(e.currentTarget); this.toggleFilter(e.currentTarget);
this.reloadActivities(); this.reloadActivities();
...@@ -22,7 +24,7 @@ export default class Activities { ...@@ -22,7 +24,7 @@ export default class Activities {
reloadActivities() { reloadActivities() {
$('.content_list').html(''); $('.content_list').html('');
Pager.init(20, true, false, data => data, this.updateTooltips); Pager.init(20, true, false, data => data, this.updateTooltips, this.container);
} }
toggleFilter(sender) { toggleFilter(sender) {
......
...@@ -7,14 +7,21 @@ const ENDLESS_SCROLL_BOTTOM_PX = 400; ...@@ -7,14 +7,21 @@ const ENDLESS_SCROLL_BOTTOM_PX = 400;
const ENDLESS_SCROLL_FIRE_DELAY_MS = 1000; const ENDLESS_SCROLL_FIRE_DELAY_MS = 1000;
export default { export default {
init(limit = 0, preload = false, disable = false, prepareData = $.noop, callback = $.noop) { init(
limit = 0,
preload = false,
disable = false,
prepareData = $.noop,
callback = $.noop,
container = '',
) {
this.url = $('.content_list').data('href') || removeParams(['limit', 'offset']); this.url = $('.content_list').data('href') || removeParams(['limit', 'offset']);
this.limit = limit; this.limit = limit;
this.offset = parseInt(getParameterByName('offset'), 10) || this.limit; this.offset = parseInt(getParameterByName('offset'), 10) || this.limit;
this.disable = disable; this.disable = disable;
this.prepareData = prepareData; this.prepareData = prepareData;
this.callback = callback; this.callback = callback;
this.loading = $('.loading').first(); this.loading = $(`${container} .loading`).first();
if (preload) { if (preload) {
this.offset = 0; this.offset = 0;
this.getOld(); this.getOld();
......
...@@ -170,7 +170,7 @@ export default class UserTabs { ...@@ -170,7 +170,7 @@ export default class UserTabs {
this.loadActivityCalendar('activity'); this.loadActivityCalendar('activity');
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Activities(); new Activities('#activity');
this.loaded.activity = true; this.loaded.activity = true;
} }
......
title: Adds container to pager to enable scoping
merge_request: 22529
? author
type: other
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment