diff options
author | Phil Hughes <me@iamphill.com> | 2018-06-01 17:03:34 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-06-06 11:18:30 +0100 |
commit | 524ebff5d17fd9111f2277843b384d204ff87a47 (patch) | |
tree | 3a59c38f778542b019fe39ce6d2d1536866aae49 /app/assets/javascripts/vue_shared/components/tabs/tabs.js | |
parent | af9cc234f2bf854de38e9730266a411f261918da (diff) | |
download | gitlab-ce-524ebff5d17fd9111f2277843b384d204ff87a47.tar.gz |
Show merge requests in IDE
Closes #45184
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/tabs/tabs.js')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/tabs/tabs.js | 17 |
1 files changed, 15 insertions, 2 deletions
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, |