diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2019-06-03 21:58:07 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-06-03 21:58:07 +0000 |
commit | e0594255b52a565ca3ad5edb789d88777727684f (patch) | |
tree | e5d869f1331e7c405f3a92e3f397439c92ca22bd | |
parent | c90e6943b1df1ee64c8e0a28ec82a712492af68f (diff) | |
download | gitlab-ce-e0594255b52a565ca3ad5edb789d88777727684f.tar.gz |
Move boardsStore.moving to BoardList component
-rw-r--r-- | app/assets/javascripts/boards/components/board_list.vue | 6 | ||||
-rw-r--r-- | app/assets/javascripts/boards/stores/boards_store.js | 5 | ||||
-rw-r--r-- | spec/javascripts/boards/boards_store_spec.js | 12 |
3 files changed, 21 insertions, 2 deletions
diff --git a/app/assets/javascripts/boards/components/board_list.vue b/app/assets/javascripts/boards/components/board_list.vue index c9972d051aa..b1a8b13f3ac 100644 --- a/app/assets/javascripts/boards/components/board_list.vue +++ b/app/assets/javascripts/boards/components/board_list.vue @@ -142,8 +142,10 @@ export default { const card = this.$refs.issue[e.oldIndex]; card.showDetail = false; - boardsStore.moving.list = card.list; - boardsStore.moving.issue = boardsStore.moving.list.findIssue(+e.item.dataset.issueId); + + const { list } = card; + const issue = list.findIssue(Number(e.item.dataset.issueId)); + boardsStore.startMoving(list, issue); sortableStart(); }, diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js index 05efcbaa3cc..838a4ed63ca 100644 --- a/app/assets/javascripts/boards/stores/boards_store.js +++ b/app/assets/javascripts/boards/stores/boards_store.js @@ -109,6 +109,11 @@ const boardsStore = { }); listFrom.update(); }, + + startMoving(list, issue) { + Object.assign(this.moving, { list, issue }); + }, + moveIssueToList(listFrom, listTo, issue, newIndex) { const issueTo = listTo.findIssue(issue.id); const issueLists = issue.getLists(); diff --git a/spec/javascripts/boards/boards_store_spec.js b/spec/javascripts/boards/boards_store_spec.js index d3e6eb78e5a..9b125593869 100644 --- a/spec/javascripts/boards/boards_store_spec.js +++ b/spec/javascripts/boards/boards_store_spec.js @@ -287,4 +287,16 @@ describe('Store', () => { expect(boardsStore.detail.issue).toEqual({}); }); }); + + describe('startMoving', () => { + it('stores list and issue', () => { + const dummyIssue = 'some issue'; + const dummyList = 'some list'; + + boardsStore.startMoving(dummyList, dummyIssue); + + expect(boardsStore.moving.issue).toEqual(dummyIssue); + expect(boardsStore.moving.list).toEqual(dummyList); + }); + }); }); |