Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0b351d55
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,发现更多精彩内容 >>
提交
0b351d55
编写于
8月 05, 2016
作者:
P
Phil Hughes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Moved some code around to make it easier to read & work with
上级
db2eabfd
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
55 addition
and
63 deletion
+55
-63
app/assets/javascripts/boards/boards_bundle.js.es6
app/assets/javascripts/boards/boards_bundle.js.es6
+1
-3
app/assets/javascripts/boards/components/board_list.js.es6
app/assets/javascripts/boards/components/board_list.js.es6
+1
-1
app/assets/javascripts/boards/models/issue.js.es6
app/assets/javascripts/boards/models/issue.js.es6
+7
-1
app/assets/javascripts/boards/models/list.js.es6
app/assets/javascripts/boards/models/list.js.es6
+15
-2
app/assets/javascripts/boards/stores/boards_store.js.es6
app/assets/javascripts/boards/stores/boards_store.js.es6
+27
-49
app/assets/stylesheets/pages/boards.scss
app/assets/stylesheets/pages/boards.scss
+0
-5
app/views/projects/boards/components/_board.html.haml
app/views/projects/boards/components/_board.html.haml
+3
-1
app/views/projects/boards/components/_card.html.haml
app/views/projects/boards/components/_card.html.haml
+1
-1
未找到文件。
app/assets/javascripts/boards/boards_bundle.js.es6
浏览文件 @
0b351d55
...
...
@@ -20,13 +20,11 @@ $(function () {
const boards = resp.json();
boards.forEach((board) => {
const list =
new List(board
);
const list =
BoardsStore.new(board, false
);
if (list.type === 'done') {
list.position = 9999999;
}
BoardsStore.state.lists.push(list);
});
BoardsStore.addBlankState();
...
...
app/assets/javascripts/boards/components/board_list.js.es6
浏览文件 @
0b351d55
...
...
@@ -71,7 +71,7 @@
toListId = parseInt(toListId) || toListId;
const issueId = parseInt(e.item.getAttribute('data-issue'));
BoardsStore.moveCardToList(fromListId, toListId, issueId
, e.newIndex
);
BoardsStore.moveCardToList(fromListId, toListId, issueId);
}
});
...
...
app/assets/javascripts/boards/models/issue.js.es6
浏览文件 @
0b351d55
...
...
@@ -6,7 +6,7 @@ class Issue {
if (obj.assignee) {
this.assignee = new User(obj.assignee);
}
this.labels = [];
obj.labels.forEach((label) => {
...
...
@@ -37,4 +37,10 @@ class Issue {
});
}
}
getLists () {
return _.filter(BoardsStore.state.lists, (list) => {
return list.findIssue(this.id);
});
}
}
app/assets/javascripts/boards/models/list.js.es6
浏览文件 @
0b351d55
...
...
@@ -24,6 +24,17 @@ class List {
}
}
save () {
service.createList(this.label.id)
.then((resp) => {
const data = resp.json();
this.id = data.id;
this.type = data.list_type;
this.position = data.position;
});
}
destroy () {
service.destroyList(this.id);
}
...
...
@@ -36,10 +47,12 @@ class List {
return this.type === 'backlog';
}
addIssue (issue,
index
) {
this.issues.
splice(index, 0,
issue);
addIssue (issue,
listFrom
) {
this.issues.
push(
issue);
issue.addLabel(this.label);
service.moveIssue(issue.id, listFrom.id, this.id);
}
findIssue (id) {
...
...
app/assets/javascripts/boards/stores/boards_store.js.es6
浏览文件 @
0b351d55
...
...
@@ -6,30 +6,23 @@
author: {},
assignee: {},
milestone: {},
label: []
}
},
new: function (board) {
new: function (board
, persist = true
) {
const doneList = this.getDoneList(),
list = new List(board);
this.state.lists.push(list);
if (list.type !== 'blank') {
service.createList(list.label.id)
.then(function (resp) {
const data = resp.json();
list.id = data.id;
list.type = data.list_type;
list.position = data.position;
});
if (persist) {
list.save();
this.removeBlankState();
this.addBlankState();
}
},
addBlankState: function () {
const doneList = this.getDoneList();
return list;
},
shouldAddBlankState: function () {
// Decide whether to add the blank state
let addBlankState = true;
...
...
@@ -39,6 +32,11 @@
return;
}
});
return addBlankState;
},
addBlankState: function () {
const doneList = this.getDoneList(),
addBlankState = this.shouldAddBlankState();
if (addBlankState) {
this.new({
...
...
@@ -46,21 +44,17 @@
list_type: 'blank',
title: 'Welcome to your Issue Board!',
position: 0
});
}
, false
);
}
},
removeBlankState: function () {
this.removeList('blank');
},
getDoneList: function () {
return _.find(this.state.lists, (list) => {
return list.type === 'done';
});
return this.findList('type', 'done');
},
removeList: function (id) {
const list = _.find(this.state.lists, (list) => {
return list.id === id;
});
const list = this.findList('id', id);
if (id !== 'blank') {
list.destroy();
...
...
@@ -75,13 +69,8 @@
}
},
moveList: function (oldIndex, newIndex) {
const listFrom = _.find(this.state.lists, (list) => {
return list.position === oldIndex;
});
const listTo = _.find(this.state.lists, (list) => {
return list.position === newIndex;
});
const listFrom = this.findList('position', oldIndex),
istTo = this.findList('position', newIndex);
listFrom.position = newIndex;
if (newIndex > listTo.position) {
...
...
@@ -92,42 +81,31 @@
listFrom.update();
},
moveCardToList: function (listFromId, listToId, issueId, toIndex) {
const listFrom = _.find(this.state.lists, (list) => {
return list.id === listFromId;
});
const listTo = _.find(this.state.lists, (list) => {
return list.id === listToId;
});
const issueTo = listTo.findIssue(issueId);
moveCardToList: function (listFromId, listToId, issueId) {
const listFrom = this.findList('id', listFromId),
listTo = this.findList('id', listToId),
issueTo = listTo.findIssue(issueId);
let issue = listFrom.findIssue(issueId);
const issueLists =
this.getListsForIssue(issue
);
const issueLists =
issue.getLists(
);
listFrom.removeIssue(issue);
// Add to new lists issues if it doesn't already exist
if (issueTo) {
issue = issueTo;
issue.removeLabel(listFrom.label);
listTo.removeIssue(issueTo);
} else {
listTo.addIssue(issue,
toIndex
);
listTo.addIssue(issue,
listFrom
);
}
if (listTo.id === 'done' && listFrom.id !== 'backlog') {
issueLists.forEach((list) => {
issue.removeLabel(list.label);
list.removeIssue(issue);
});
}
service.moveIssue(issue.id, listFrom.id, listTo.id);
},
getListsForIssue: function (issue
) {
return _.fi
lter
(this.state.lists, (list) => {
return list
.findIssue(issue.id)
;
findList: function (key, val
) {
return _.fi
nd
(this.state.lists, (list) => {
return list
[key] === val
;
});
},
clearDone: function () {
Vue.set(BoardsStore.state, 'done', {});
}
};
}(window));
app/assets/stylesheets/pages/boards.scss
浏览文件 @
0b351d55
...
...
@@ -237,8 +237,3 @@
margin-right
:
8px
;
font-weight
:
500
;
}
.card-avatar
{
margin-top
:
-2px
;
border-radius
:
50%
;
}
app/views/projects/boards/components/_board.html.haml
浏览文件 @
0b351d55
...
...
@@ -25,6 +25,8 @@
":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
,
":data-board"
=>
"boardId"
}
%ul
.board-list
{
"v-el:list"
=>
true
,
"v-show"
=>
"!loading"
,
":data-board"
=>
"boardId"
}
=
render
"projects/boards/components/card"
=
render
"projects/boards/components/blank_state"
app/views/projects/boards/components/_card.html.haml
浏览文件 @
0b351d55
...
...
@@ -9,4 +9,4 @@
%span
.label.color-label
{
"v-for"
=>
"label in issue.labels"
,
":style"
=>
"{ backgroundColor: label.color, color: label.textColor }"
}
{{ label.title }}
%a
{
":href"
=>
"'/u/' + issue.assignee.username"
,
":title"
=>
"issue.assignee.name"
,
"v-if"
=>
"issue.assignee"
}
%img
.
card-avatar
{
":src"
=>
"issue.assignee.avatar"
,
width:
20
,
height:
20
}
%img
.
avatar.avatar-inline.s20
{
":src"
=>
"issue.assignee.avatar"
,
width:
20
,
height:
20
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录