diff --git a/app/assets/javascripts/boards/boards_bundle.js.es6 b/app/assets/javascripts/boards/boards_bundle.js.es6 index 09f5caee921bb016384815eaa894d7279abccd9f..ef73d381fb46a303f768c278e2ec6082a4e85673 100644 --- a/app/assets/javascripts/boards/boards_bundle.js.es6 +++ b/app/assets/javascripts/boards/boards_bundle.js.es6 @@ -5,6 +5,7 @@ //= require vue //= require vue-resource //= require Sortable +//= require masonry //= require_tree ./models //= require_tree ./stores //= require_tree ./services diff --git a/app/assets/javascripts/boards/components/modal/list.js.es6 b/app/assets/javascripts/boards/components/modal/list.js.es6 index d4b3bcc71d7ede63d7405954fdf84c1ce8868e65..e06fa58b3b6ae02508e1c831f26d0aa6d5b08fb2 100644 --- a/app/assets/javascripts/boards/components/modal/list.js.es6 +++ b/app/assets/javascripts/boards/components/modal/list.js.es6 @@ -10,11 +10,39 @@ data() { return Store.modal; }, + watch: { + activeTab() { + this.$nextTick(() => { + this.destroyMasonry(); + this.initMasonry(); + }); + }, + }, computed: { loading() { return this.issues.length === 0; }, }, + methods: { + toggleIssue(issue) { + issue.selected = !issue.selected; + }, + showIssue(issue) { + if (this.activeTab === 'all') return true; + + return issue.selected; + }, + initMasonry() { + listMasonry = new Masonry(this.$refs.list, { + transitionDuration: 0, + }); + }, + destroyMasonry() { + if (listMasonry) { + listMasonry.destroy(); + } + } + }, mounted() { gl.boardService.getBacklog() .then((res) => { @@ -23,8 +51,16 @@ data.forEach((issueObj) => { this.issues.push(new ListIssue(issueObj)); }); + + this.$nextTick(() => { + this.initMasonry(); + }); }); }, + destroyed() { + this.issues = []; + this.destroyMasonry(); + }, components: { 'issue-card-inner': gl.issueBoards.IssueCardInner, }, @@ -33,18 +69,25 @@ - + ref="list" + v-show="!loading"> +
+
+ + +
+
+ `, }); diff --git a/app/assets/javascripts/boards/components/modal/tabs.js.es6 b/app/assets/javascripts/boards/components/modal/tabs.js.es6 index bfdfd7e2bf5aa1951ad1a98c5b9eecc4a6a01944..58fb75f839f344538b90f19aae58220251ff3756 100644 --- a/app/assets/javascripts/boards/components/modal/tabs.js.es6 +++ b/app/assets/javascripts/boards/components/modal/tabs.js.es6 @@ -14,6 +14,19 @@ this.activeTab = tab; }, }, + computed: { + selectedCount() { + let count = 0; + + this.issues.forEach((issue) => { + if (issue.selected) { + count += 1; + } + }); + + return count; + }, + }, template: `