2021-01-30 17:17:04 +01:00
|
|
|
<template>
|
|
|
|
<create-edit
|
2021-06-24 01:24:57 +02:00
|
|
|
:title="$t('list.share.header')"
|
2021-01-30 17:17:04 +01:00
|
|
|
primary-label=""
|
|
|
|
>
|
|
|
|
<component
|
|
|
|
:id="list.id"
|
|
|
|
:is="manageUsersComponent"
|
|
|
|
:userIsAdmin="userIsAdmin"
|
|
|
|
shareType="user"
|
|
|
|
type="list"/>
|
|
|
|
<component
|
|
|
|
:id="list.id"
|
|
|
|
:is="manageTeamsComponent"
|
|
|
|
:userIsAdmin="userIsAdmin"
|
|
|
|
shareType="team"
|
|
|
|
type="list"/>
|
|
|
|
|
|
|
|
<link-sharing :list-id="$route.params.listId" v-if="linkSharingEnabled" class="mt-4"/>
|
|
|
|
</create-edit>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import ListService from '@/services/list'
|
|
|
|
import ListModel from '@/models/list'
|
|
|
|
import {CURRENT_LIST} from '@/store/mutation-types'
|
|
|
|
|
2021-07-25 15:27:15 +02:00
|
|
|
import CreateEdit from '@/components/misc/create-edit.vue'
|
|
|
|
import LinkSharing from '@/components/sharing/linkSharing.vue'
|
|
|
|
import userTeam from '@/components/sharing/userTeam.vue'
|
2021-01-30 17:17:04 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'list-setting-share',
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
list: ListModel,
|
2021-09-08 11:59:38 +02:00
|
|
|
listService: new ListService(),
|
2021-01-30 17:17:04 +01:00
|
|
|
manageUsersComponent: '',
|
|
|
|
manageTeamsComponent: '',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
CreateEdit,
|
|
|
|
LinkSharing,
|
|
|
|
userTeam,
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
linkSharingEnabled() {
|
|
|
|
return this.$store.state.config.linkSharingEnabled
|
|
|
|
},
|
|
|
|
userIsAdmin() {
|
|
|
|
return this.list.owner && this.list.owner.id === this.$store.state.auth.info.id
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.loadList()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadList() {
|
|
|
|
const list = new ListModel({id: this.$route.params.listId})
|
|
|
|
|
|
|
|
this.listService.get(list)
|
|
|
|
.then(r => {
|
|
|
|
this.$set(this, 'list', r)
|
|
|
|
this.$store.commit(CURRENT_LIST, r)
|
|
|
|
// This will trigger the dynamic loading of components once we actually have all the data to pass to them
|
|
|
|
this.manageTeamsComponent = 'userTeam'
|
|
|
|
this.manageUsersComponent = 'userTeam'
|
2021-06-24 01:24:57 +02:00
|
|
|
this.setTitle(this.$t('list.share.title', {list: this.list.title}))
|
2021-01-30 17:17:04 +01:00
|
|
|
})
|
|
|
|
.catch(e => {
|
2021-08-25 12:28:29 +02:00
|
|
|
this.$message.error(e)
|
2021-01-30 17:17:04 +01:00
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|