From 524ebff5d17fd9111f2277843b384d204ff87a47 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 1 Jun 2018 17:03:34 +0100 Subject: Show merge requests in IDE Closes #45184 --- .../javascripts/vue_shared/components/tabs/tabs.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'app/assets/javascripts/vue_shared/components/tabs/tabs.js') diff --git a/app/assets/javascripts/vue_shared/components/tabs/tabs.js b/app/assets/javascripts/vue_shared/components/tabs/tabs.js index 4362264caa5..8497c3e851f 100644 --- a/app/assets/javascripts/vue_shared/components/tabs/tabs.js +++ b/app/assets/javascripts/vue_shared/components/tabs/tabs.js @@ -1,4 +1,11 @@ export default { + props: { + stopPropagation: { + type: Boolean, + required: false, + default: false, + }, + }, data() { return { currentIndex: 0, @@ -13,11 +20,17 @@ export default { this.tabs = this.$children.filter(child => child.isTab); this.currentIndex = this.tabs.findIndex(tab => tab.localActive); }, - setTab(index) { + setTab(e, index) { + if (this.stopPropagation) { + e.stopPropagation(); + } + this.tabs[this.currentIndex].localActive = false; this.tabs[index].localActive = true; this.currentIndex = index; + + this.$emit('changed', this.currentIndex); }, }, render(h) { @@ -36,7 +49,7 @@ export default { href: '#', }, on: { - click: () => this.setTab(i), + click: e => this.setTab(e, i), }, }, tab.$slots.title || tab.title, -- cgit v1.2.1