Merge branch '53023-endless-scroll-loader-is-visible-on-user-profile-overview-page' into 'master'

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

Closes #53023

See merge request gitlab-org/gitlab-ce!22529
This commit is contained in:
Mike Greiling 2018-10-24 06:25:46 +00:00
commit efc06cb3c3
4 changed files with 20 additions and 7 deletions

View file

@ -6,10 +6,12 @@ import Pager from './pager';
import { localTimeAgo } from './lib/utils/datetime_utility';
export default class Activities {
constructor() {
Pager.init(20, true, false, data => data, this.updateTooltips);
constructor(container = '') {
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();
this.toggleFilter(e.currentTarget);
this.reloadActivities();
@ -22,7 +24,7 @@ export default class Activities {
reloadActivities() {
$('.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) {

View file

@ -7,14 +7,21 @@ const ENDLESS_SCROLL_BOTTOM_PX = 400;
const ENDLESS_SCROLL_FIRE_DELAY_MS = 1000;
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.limit = limit;
this.offset = parseInt(getParameterByName('offset'), 10) || this.limit;
this.disable = disable;
this.prepareData = prepareData;
this.callback = callback;
this.loading = $('.loading').first();
this.loading = $(`${container} .loading`).first();
if (preload) {
this.offset = 0;
this.getOld();

View file

@ -170,7 +170,7 @@ export default class UserTabs {
this.loadActivityCalendar('activity');
// eslint-disable-next-line no-new
new Activities();
new Activities('#activity');
this.loaded.activity = true;
}

View file

@ -0,0 +1,4 @@
title: Adds container to pager to enable scoping
merge_request: 22529
? author
type: other