diff options
author | Phil Hughes <me@iamphill.com> | 2016-08-05 14:58:42 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-08-17 17:12:47 +0100 |
commit | d06e20b2635a97f2a6533ec6ecdbfc31b182e134 (patch) | |
tree | eccfb4a71cdc010f224c463ba23cea49bed1b085 /app/assets/javascripts/boards/models | |
parent | 9d307ee0260caac256eac88da0f6910035f41597 (diff) | |
download | gitlab-ce-d06e20b2635a97f2a6533ec6ecdbfc31b182e134.tar.gz |
Added ability to infinite scroll issues list
Diffstat (limited to 'app/assets/javascripts/boards/models')
-rw-r--r-- | app/assets/javascripts/boards/models/list.js.es6 | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/app/assets/javascripts/boards/models/list.js.es6 b/app/assets/javascripts/boards/models/list.js.es6 index 4639491f4aa..aa73c93f52b 100644 --- a/app/assets/javascripts/boards/models/list.js.es6 +++ b/app/assets/javascripts/boards/models/list.js.es6 @@ -4,6 +4,8 @@ class List { this.position = obj.position; this.title = obj.title; this.type = obj.list_type; + this.filters = {}; + this.page = 1; this.loading = true; this.issues = []; @@ -39,19 +41,34 @@ class List { gl.boardService.updateList(this); } + nextPage () { + if (this.issues.length / 20 === this.page) { + this.page++; + + return this.getIssues(false); + } + } + canSearch () { return this.type === 'backlog'; } - getIssues (filter = {}) { - this.loading = true; + getIssues (emptyIssues = true) { + const data = _.extend({ page: this.page }, this.filters); - gl.boardService.getIssuesForList(this.id, filter) + if (emptyIssues) { + this.loading = true; + } + + return gl.boardService.getIssuesForList(this.id, data) .then((resp) => { const data = resp.json(); this.loading = false; - this.issues = []; + if (emptyIssues) { + this.issues = []; + } + this.createIssues(data); }); } |