Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d06e20b2
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d06e20b2
编写于
8月 05, 2016
作者:
P
Phil Hughes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added ability to infinite scroll issues list
上级
9d307ee0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
17 deletion
+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
未找到文件。
app/assets/javascripts/boards/components/board.js.es6
浏览文件 @
d06e20b2
...
...
@@ -11,14 +11,19 @@
watch: {
'query': function () {
if (this.board.canSearch()) {
const data = _.extend(this.filters, { search: this.query }
);
this.board.getIssues(
data
);
this.board.filters = this.getFilterData(
);
this.board.getIssues(
true
);
}
}
},
methods: {
clearSearch: function () {
this.query = '';
},
getFilterData: function () {
const queryData = this.board.canSearch() ? { search: this.query } : {};
return _.extend(this.filters, queryData);
}
},
computed: {
...
...
app/assets/javascripts/boards/components/board_list.js.es6
浏览文件 @
d06e20b2
...
...
@@ -2,16 +2,15 @@
const BoardList = Vue.extend({
props: {
disabled: Boolean,
boardId: [Number, String],
filters: Object,
list: Object,
issues: Array,
loading: Boolean,
issueLinkBase: String
},
data: function () {
return {
scrollOffset: 20,
loadMore: false
scrollOffset: 2
5
0,
load
ing
More: false
};
},
methods: {
...
...
@@ -24,8 +23,15 @@
scrollTop: function () {
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 () {
...
...
@@ -51,8 +57,8 @@
// Scroll event on list to load more
this.$els.list.onscroll = () => {
if ((this.scrollTop() > this.scrollHeight() - this.scrollOffset) && !this.loadMore) {
this.load
FromLastId
();
if ((this.scrollTop() > this.scrollHeight() - this.scrollOffset) && !this.load
ing
More) {
this.load
NextPage
();
}
};
}
...
...
app/assets/javascripts/boards/models/list.js.es6
浏览文件 @
d06e20b2
...
...
@@ -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);
});
}
...
...
app/views/projects/boards/components/_board.html.haml
浏览文件 @
d06e20b2
...
...
@@ -15,18 +15,17 @@
%button
.board-search-clear-btn
{
type:
"button"
,
role:
"button"
,
"aria-label"
=>
"Clear search"
,
"@click"
=>
"clearSearch"
,
"v-show"
=>
"query"
}
=
icon
(
"times"
,
class:
"board-search-clear"
)
%board-list
{
"inline-template"
=>
true
,
"v-if"
=>
"board.
id !
= 'blank'"
,
":
board-id"
=>
"board.i
d"
,
"v-if"
=>
"board.
type !=
= 'blank'"
,
":
list"
=>
"boar
d"
,
":issues"
=>
"board.issues"
,
":disabled"
=>
"#{current_user.nil?}"
,
":filters"
=>
"filters"
,
":loading"
=>
"board.loading"
,
":issue-link-base"
=>
"'#{namespace_project_issues_path(@project.namespace, @project)}'"
}
.board-list-loading.text-center
{
"v-if"
=>
"loading"
}
=
icon
(
"spinner spin"
)
%ul
.board-list
{
"v-el:list"
=>
true
,
"v-show"
=>
"!loading"
,
":data-board"
=>
"
boardI
d"
}
":data-board"
=>
"
list.i
d"
}
=
render
"projects/boards/components/card"
-
if
current_user
=
render
"projects/boards/components/blank_state"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录