manage event from home if allowed
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
v-card.h-event.event.d-flex
|
v-card.h-event.event.d-flex
|
||||||
nuxt-link(:to='`/event/${event.slug || event.id}`')
|
nuxt-link(:to='`/event/${event.slug || event.id}`')
|
||||||
v-img.img(:src="`/media/thumb/${event.image_path || 'logo.svg' }`")
|
|
||||||
v-icon.float-right.mr-1(v-if='event.parentId' color='success') mdi-repeat
|
v-icon.float-right.mr-1(v-if='event.parentId' color='success') mdi-repeat
|
||||||
.title.p-name {{event.title}}
|
.title.p-name {{event.title}}
|
||||||
|
|
||||||
@@ -32,7 +31,16 @@
|
|||||||
v-icon mdi-calendar-export
|
v-icon mdi-calendar-export
|
||||||
v-list-item-content
|
v-list-item-content
|
||||||
v-list-item-title {{$t('common.add_to_calendar')}}
|
v-list-item-title {{$t('common.add_to_calendar')}}
|
||||||
|
v-list-item(v-if='is_mine' :to='`/add/${event.id}`')
|
||||||
|
v-list-item-icon
|
||||||
|
v-icon mdi-pencil
|
||||||
|
v-list-item-content
|
||||||
|
v-list-item-title {{$t('common.edit')}}
|
||||||
|
v-list-item(v-if='is_mine' @click='remove(false)')
|
||||||
|
v-list-item-icon
|
||||||
|
v-icon(color='error') mdi-delete-forever
|
||||||
|
v-list-item-content
|
||||||
|
v-list-item-title {{$t('common.remove')}}
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
@@ -41,6 +49,24 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
event: { type: Object, default: () => ({}) }
|
event: { type: Object, default: () => ({}) }
|
||||||
},
|
},
|
||||||
computed: mapState(['settings'])
|
computed: {
|
||||||
|
...mapState(['settings']),
|
||||||
|
is_mine () {
|
||||||
|
if (!this.$auth.user) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
this.event.userId === this.$auth.user.id || this.$auth.user.is_admin
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async remove () {
|
||||||
|
const ret = await this.$root.$confirm('event.remove_confirmation')
|
||||||
|
if (!ret) { return }
|
||||||
|
await this.$axios.delete(`/event/${this.event.id}`)
|
||||||
|
this.$emit('destroy', this.event.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user