BigW Consortium Gitlab

Commit 87cab11c by Phil Hughes

Test added a mock list

parent 99915931
...@@ -26,6 +26,17 @@ $(() => { ...@@ -26,6 +26,17 @@ $(() => {
selectable: true, selectable: true,
clicked: (label, $el, e) => { clicked: (label, $el, e) => {
e.preventDefault(); 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 @@ ...@@ -10,13 +10,27 @@
} }
}, },
new: function (board) { new: function (board) {
// Move the done list index
const doneList = this.getDoneList();
if (doneList) {
doneList.index = board.index + 1;
}
const list = new List(board); const list = new List(board);
this.state.lists.push(list); this.state.lists.push(list);
}, },
getDoneList: function () {
return _.find(this.state.lists, (list) => {
return list.id === 'done';
});
},
removeList: function (id) { removeList: function (id) {
this.state.lists = _.reject(this.state.lists, (list) => { this.state.lists = _.reject(this.state.lists, (list) => {
return list.id === id; return list.id === id;
}); });
this.getDoneList().index = this.state.lists.length - 1;
}, },
moveList: function (oldIndex, newIndex) { moveList: function (oldIndex, newIndex) {
const listFrom = _.find(this.state.lists, (list) => { const listFrom = _.find(this.state.lists, (list) => {
...@@ -48,7 +62,7 @@ ...@@ -48,7 +62,7 @@
const issueLists = this.getListsForIssue(issue); const issueLists = this.getListsForIssue(issue);
listFrom.removeIssue(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) { if (issueTo) {
issue = issueTo; issue = issueTo;
issue.removeLabel(listFrom.label); issue.removeLabel(listFrom.label);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment