(() => { const Store = gl.issueBoards.BoardsStore; window.gl = window.gl || {}; window.gl.issueBoards = window.gl.issueBoards || {}; gl.issueBoards.BoardCard = Vue.extend({ props: { list: Object, issue: Object, issueLinkBase: String, disabled: Boolean, index: Number }, data () { return { showDetail: false, detailIssue: Store.detail }; }, computed: { issueDetailVisible () { if (this.detailIssue.issue && this.detailIssue.issue.id === this.issue.id) { return true; } else { return false; } } }, methods: { filterByLabel (label, e) { let labelToggleText = label.title; const labelIndex = Store.state.filters['label_name'].indexOf(label.title); $(e.target).tooltip('hide'); if (labelIndex === -1) { Store.state.filters['label_name'].push(label.title); $('.labels-filter').prepend(``); } else { Store.state.filters['label_name'].splice(labelIndex, 1); labelToggleText = Store.state.filters['label_name'][0]; $(`.labels-filter input[name="label_name[]"][value="${label.title}"]`).remove(); } const selectedLabels = Store.state.filters['label_name']; if (selectedLabels.length === 0) { labelToggleText = 'Label'; } else if (selectedLabels.length > 1) { labelToggleText = `${selectedLabels[0]} + ${selectedLabels.length - 1} more`; } $('.labels-filter .dropdown-toggle-text').text(labelToggleText); Store.updateFiltersUrl(); }, mouseDown () { this.showDetail = true; }, mouseMove () { if (this.showDetail) { this.showDetail = false; } }, showIssue () { if (this.showDetail) { this.showDetail = false; Vue.set(Store.detail, 'issue', this.issue); } } } }); })();