From c7cecae616702a46430ed41e283912ddc22f2612 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 14 Mar 2017 11:32:58 +0000 Subject: added eventhub to emit update tokens event --- app/assets/javascripts/boards/boards_bundle.js | 5 +++-- app/assets/javascripts/boards/components/issue_card_inner.js | 4 +++- app/assets/javascripts/boards/eventhub.js | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/boards/eventhub.js (limited to 'app/assets/javascripts/boards') diff --git a/app/assets/javascripts/boards/boards_bundle.js b/app/assets/javascripts/boards/boards_bundle.js index 4d60fedaeb8..3874c2819a5 100644 --- a/app/assets/javascripts/boards/boards_bundle.js +++ b/app/assets/javascripts/boards/boards_bundle.js @@ -3,6 +3,7 @@ /* global BoardService */ import FilteredSearchBoards from './filtered_search_boards'; +import eventHub from './eventhub'; window.Vue = require('vue'); window.Vue.use(require('vue-resource')); @@ -65,10 +66,10 @@ $(() => { this.filterManager = new FilteredSearchBoards(Store.filter, true); // Listen for updateTokens event - this.$on('updateTokens', this.updateTokens); + eventHub.$on('updateTokens', this.updateTokens); }, beforeDestroy() { - this.$off('updateTokens', this.updateTokens); + eventHub.$off('updateTokens', this.updateTokens); }, mounted () { Store.disabled = this.disabled; diff --git a/app/assets/javascripts/boards/components/issue_card_inner.js b/app/assets/javascripts/boards/components/issue_card_inner.js index 3d57ec429c6..69e30cec4c5 100644 --- a/app/assets/javascripts/boards/components/issue_card_inner.js +++ b/app/assets/javascripts/boards/components/issue_card_inner.js @@ -1,4 +1,6 @@ /* global Vue */ +import eventHub from '../eventhub'; + (() => { const Store = gl.issueBoards.BoardsStore; @@ -54,7 +56,7 @@ Store.updateFiltersUrl(); - gl.IssueBoardsApp.$emit('updateTokens'); + eventHub.$emit('updateTokens'); }, labelStyle(label) { return { diff --git a/app/assets/javascripts/boards/eventhub.js b/app/assets/javascripts/boards/eventhub.js new file mode 100644 index 00000000000..0948c2e5352 --- /dev/null +++ b/app/assets/javascripts/boards/eventhub.js @@ -0,0 +1,3 @@ +import Vue from 'vue'; + +export default new Vue(); -- cgit v1.2.1