Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Knox <psimyn@gmail.com>2017-02-27 05:05:50 +0300
committerSimon Knox <psimyn@gmail.com>2017-03-08 23:32:34 +0300
commit08c141b954af5d83cffe9891ff0d8f62c646ae34 (patch)
treeab1bbe5abf020d9f58745ff0ae219c6287721cb1 /app/assets/javascripts/pager.js
parenta57a0e3d606c80fbcecd126148631dabbd44347b (diff)
respect offset and limit query params for infinite lists
Diffstat (limited to 'app/assets/javascripts/pager.js')
-rw-r--r--app/assets/javascripts/pager.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/assets/javascripts/pager.js b/app/assets/javascripts/pager.js
index e35cf6d295e..5f6bc902cf8 100644
--- a/app/assets/javascripts/pager.js
+++ b/app/assets/javascripts/pager.js
@@ -1,11 +1,15 @@
+require('~/lib/utils/common_utils');
+require('~/lib/utils/url_utility');
+
(() => {
const ENDLESS_SCROLL_BOTTOM_PX = 400;
const ENDLESS_SCROLL_FIRE_DELAY_MS = 1000;
const Pager = {
init(limit = 0, preload = false, disable = false, callback = $.noop) {
+ this.url = $('.content_list').data('href') || gl.utils.removeParams(['limit', 'offset']);
this.limit = limit;
- this.offset = this.limit;
+ this.offset = parseInt(gl.utils.getParameterByName('offset'), 10) || this.limit;
this.disable = disable;
this.callback = callback;
this.loading = $('.loading').first();
@@ -20,7 +24,7 @@
this.loading.show();
$.ajax({
type: 'GET',
- url: $('.content_list').data('href') || window.location.href,
+ url: this.url,
data: `limit=${this.limit}&offset=${this.offset}`,
dataType: 'json',
error: () => this.loading.hide(),