From 97fbb3d1ff1d22aa8597ff0bad0520634d9e351e Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 25 Jan 2017 11:33:45 +0000 Subject: [PATCH] Added selectable list before adding issues Adds issues to list on frontend - need to push to backend --- .../javascripts/boards/boards_bundle.js.es6 | 6 ++ .../boards/components/modal/footer.js.es6 | 31 +++++++--- .../components/modal/lists_dropdown.js.es6 | 61 +++++++++++++++++++ .../boards/stores/boards_store.js.es6 | 3 +- app/assets/stylesheets/pages/boards.scss | 7 +++ 5 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 app/assets/javascripts/boards/components/modal/lists_dropdown.js.es6 diff --git a/app/assets/javascripts/boards/boards_bundle.js.es6 b/app/assets/javascripts/boards/boards_bundle.js.es6 index ef73d381fb4..67d9f023866 100644 --- a/app/assets/javascripts/boards/boards_bundle.js.es6 +++ b/app/assets/javascripts/boards/boards_bundle.js.es6 @@ -71,6 +71,12 @@ $(() => { Store.addBlankState(); this.loading = false; + + if (this.state.lists.length > 0) { + Store.modal.selectedList = this.state.lists[0]; + } + + Store.modal.showAddIssuesModal = true; }); } }); diff --git a/app/assets/javascripts/boards/components/modal/footer.js.es6 b/app/assets/javascripts/boards/components/modal/footer.js.es6 index aadb754fd9e..e9f400952b7 100644 --- a/app/assets/javascripts/boards/components/modal/footer.js.es6 +++ b/app/assets/javascripts/boards/components/modal/footer.js.es6 @@ -1,3 +1,4 @@ +//= require ./lists_dropdown /* global Vue */ (() => { const Store = gl.issueBoards.BoardsStore; @@ -31,18 +32,34 @@ addIssues() { const issueIds = this.store.issues.filter(issue => issue.selected).map(issue => issue.id); + issueIds.forEach((id) => { + const issue = this.store.issues.filter(issue => issue.id == id)[0]; + this.store.selectedList.addIssue(issue); + this.store.selectedList.issuesSize += 1; + }); + this.disabled = true; + this.hideModal(); }, }, + components: { + 'lists-dropdown': gl.issueBoards.ModalFooterListsDropdown, + }, template: `