Allow group links on challenge details to be opened in a new tab (#11889)

* - Use `router-link` in `groupLink` to make links that can be followed in a new tab

* - Add back the missing `if` statement that was removed in error
This commit is contained in:
Tom Thorpe 2020-02-29 17:46:41 +00:00 committed by GitHub
parent b8c2d5eb20
commit c00a1d74f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,10 @@
<template>
<b-link
<router-link
v-if="group"
@click.prevent="goToGroup"
:to="toPath"
>
{{ group.name }}
</b-link>
</router-link>
</template>
<script>
@ -12,15 +12,26 @@ import { TAVERN_ID } from '@/../../common/script/constants';
export default {
props: ['group'],
methods: {
goToGroup () {
if (this.group.type === 'party') {
this.$router.push({ name: 'party' });
} else if (this.group._id === TAVERN_ID) {
this.$router.push({ name: 'tavern' });
} else {
this.$router.push({ name: 'guild', params: { groupId: this.group._id } });
computed: {
toPath () {
if (this.group._id === TAVERN_ID) {
return {
name: 'tavern',
};
}
if (this.group.type === 'party') {
return {
name: 'party',
};
}
return {
name: 'guild',
params: {
groupId: this.group._id,
},
};
},
},
};