Test added a mock list
This commit is contained in:
parent
99915931bc
commit
87cab11c1b
2 changed files with 26 additions and 1 deletions
|
@ -26,6 +26,17 @@ $(() => {
|
|||
selectable: true,
|
||||
clicked: (label, $el, e) => {
|
||||
e.preventDefault();
|
||||
BoardsStore.new({
|
||||
id: BoardsStore.state.lists.length - 1,
|
||||
title: label.title,
|
||||
index: BoardsStore.state.lists.length - 1,
|
||||
label: {
|
||||
title: label.title,
|
||||
backgroundColor: label.color,
|
||||
color: '#fff'
|
||||
},
|
||||
issues: []
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,13 +10,27 @@
|
|||
}
|
||||
},
|
||||
new: function (board) {
|
||||
// Move the done list index
|
||||
const doneList = this.getDoneList();
|
||||
|
||||
if (doneList) {
|
||||
doneList.index = board.index + 1;
|
||||
}
|
||||
|
||||
const list = new List(board);
|
||||
this.state.lists.push(list);
|
||||
},
|
||||
getDoneList: function () {
|
||||
return _.find(this.state.lists, (list) => {
|
||||
return list.id === 'done';
|
||||
});
|
||||
},
|
||||
removeList: function (id) {
|
||||
this.state.lists = _.reject(this.state.lists, (list) => {
|
||||
return list.id === id;
|
||||
});
|
||||
|
||||
this.getDoneList().index = this.state.lists.length - 1;
|
||||
},
|
||||
moveList: function (oldIndex, newIndex) {
|
||||
const listFrom = _.find(this.state.lists, (list) => {
|
||||
|
@ -48,7 +62,7 @@
|
|||
const issueLists = this.getListsForIssue(issue);
|
||||
listFrom.removeIssue(issue);
|
||||
|
||||
// Add to new boards issues if it doesn't already exist
|
||||
// Add to new lists issues if it doesn't already exist
|
||||
if (issueTo) {
|
||||
issue = issueTo;
|
||||
issue.removeLabel(listFrom.label);
|
||||
|
|
Loading…
Reference in a new issue