Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
d06e20b2
Commit
d06e20b2
authored
Aug 05, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ability to infinite scroll issues list
parent
9d307ee0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
17 deletions
+44
-17
app/assets/javascripts/boards/components/board.js.es6
app/assets/javascripts/boards/components/board.js.es6
+7
-2
app/assets/javascripts/boards/components/board_list.js.es6
app/assets/javascripts/boards/components/board_list.js.es6
+13
-7
app/assets/javascripts/boards/models/list.js.es6
app/assets/javascripts/boards/models/list.js.es6
+21
-4
app/views/projects/boards/components/_board.html.haml
app/views/projects/boards/components/_board.html.haml
+3
-4
No files found.
app/assets/javascripts/boards/components/board.js.es6
View file @
d06e20b2
...
@@ -11,14 +11,19 @@
...
@@ -11,14 +11,19 @@
watch: {
watch: {
'query': function () {
'query': function () {
if (this.board.canSearch()) {
if (this.board.canSearch()) {
const data = _.extend(this.filters, { search: this.query }
);
this.board.filters = this.getFilterData(
);
this.board.getIssues(
data
);
this.board.getIssues(
true
);
}
}
}
}
},
},
methods: {
methods: {
clearSearch: function () {
clearSearch: function () {
this.query = '';
this.query = '';
},
getFilterData: function () {
const queryData = this.board.canSearch() ? { search: this.query } : {};
return _.extend(this.filters, queryData);
}
}
},
},
computed: {
computed: {
...
...
app/assets/javascripts/boards/components/board_list.js.es6
View file @
d06e20b2
...
@@ -2,16 +2,15 @@
...
@@ -2,16 +2,15 @@
const BoardList = Vue.extend({
const BoardList = Vue.extend({
props: {
props: {
disabled: Boolean,
disabled: Boolean,
boardId: [Number, String],
list: Object,
filters: Object,
issues: Array,
issues: Array,
loading: Boolean,
loading: Boolean,
issueLinkBase: String
issueLinkBase: String
},
},
data: function () {
data: function () {
return {
return {
scrollOffset: 20,
scrollOffset: 2
5
0,
loadMore: false
load
ing
More: false
};
};
},
},
methods: {
methods: {
...
@@ -24,8 +23,15 @@
...
@@ -24,8 +23,15 @@
scrollTop: function () {
scrollTop: function () {
return this.$els.list.scrollTop + this.listHeight();
return this.$els.list.scrollTop + this.listHeight();
},
},
loadFromLastId: function () {
loadNextPage: function () {
this.loadingMore = true;
const getIssues = this.list.nextPage();
if (getIssues) {
getIssues.then(() => {
this.loadingMore = false;
});
}
},
},
},
},
ready: function () {
ready: function () {
...
@@ -51,8 +57,8 @@
...
@@ -51,8 +57,8 @@
// Scroll event on list to load more
// Scroll event on list to load more
this.$els.list.onscroll = () => {
this.$els.list.onscroll = () => {
if ((this.scrollTop() > this.scrollHeight() - this.scrollOffset) && !this.loadMore) {
if ((this.scrollTop() > this.scrollHeight() - this.scrollOffset) && !this.load
ing
More) {
this.load
FromLastId
();
this.load
NextPage
();
}
}
};
};
}
}
...
...
app/assets/javascripts/boards/models/list.js.es6
View file @
d06e20b2
...
@@ -4,6 +4,8 @@ class List {
...
@@ -4,6 +4,8 @@ class List {
this.position = obj.position;
this.position = obj.position;
this.title = obj.title;
this.title = obj.title;
this.type = obj.list_type;
this.type = obj.list_type;
this.filters = {};
this.page = 1;
this.loading = true;
this.loading = true;
this.issues = [];
this.issues = [];
...
@@ -39,19 +41,34 @@ class List {
...
@@ -39,19 +41,34 @@ class List {
gl.boardService.updateList(this);
gl.boardService.updateList(this);
}
}
nextPage () {
if (this.issues.length / 20 === this.page) {
this.page++;
return this.getIssues(false);
}
}
canSearch () {
canSearch () {
return this.type === 'backlog';
return this.type === 'backlog';
}
}
getIssues (
filter = {}
) {
getIssues (
emptyIssues = true
) {
this.loading = 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) => {
.then((resp) => {
const data = resp.json();
const data = resp.json();
this.loading = false;
this.loading = false;
this.issues = [];
if (emptyIssues) {
this.issues = [];
}
this.createIssues(data);
this.createIssues(data);
});
});
}
}
...
...
app/views/projects/boards/components/_board.html.haml
View file @
d06e20b2
...
@@ -15,18 +15,17 @@
...
@@ -15,18 +15,17 @@
%button
.board-search-clear-btn
{
type:
"button"
,
role:
"button"
,
"aria-label"
=>
"Clear search"
,
"@click"
=>
"clearSearch"
,
"v-show"
=>
"query"
}
%button
.board-search-clear-btn
{
type:
"button"
,
role:
"button"
,
"aria-label"
=>
"Clear search"
,
"@click"
=>
"clearSearch"
,
"v-show"
=>
"query"
}
=
icon
(
"times"
,
class:
"board-search-clear"
)
=
icon
(
"times"
,
class:
"board-search-clear"
)
%board-list
{
"inline-template"
=>
true
,
%board-list
{
"inline-template"
=>
true
,
"v-if"
=>
"board.
id !
= 'blank'"
,
"v-if"
=>
"board.
type !=
= 'blank'"
,
":
board-id"
=>
"board.i
d"
,
":
list"
=>
"boar
d"
,
":issues"
=>
"board.issues"
,
":issues"
=>
"board.issues"
,
":disabled"
=>
"#{current_user.nil?}"
,
":disabled"
=>
"#{current_user.nil?}"
,
":filters"
=>
"filters"
,
":loading"
=>
"board.loading"
,
":loading"
=>
"board.loading"
,
":issue-link-base"
=>
"'#{namespace_project_issues_path(@project.namespace, @project)}'"
}
":issue-link-base"
=>
"'#{namespace_project_issues_path(@project.namespace, @project)}'"
}
.board-list-loading.text-center
{
"v-if"
=>
"loading"
}
.board-list-loading.text-center
{
"v-if"
=>
"loading"
}
=
icon
(
"spinner spin"
)
=
icon
(
"spinner spin"
)
%ul
.board-list
{
"v-el:list"
=>
true
,
%ul
.board-list
{
"v-el:list"
=>
true
,
"v-show"
=>
"!loading"
,
"v-show"
=>
"!loading"
,
":data-board"
=>
"
boardI
d"
}
":data-board"
=>
"
list.i
d"
}
=
render
"projects/boards/components/card"
=
render
"projects/boards/components/card"
-
if
current_user
-
if
current_user
=
render
"projects/boards/components/blank_state"
=
render
"projects/boards/components/blank_state"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment