Verified Commit 91f482df authored by les's avatar les
Browse files

manage event from home if allowed

parent 0f9fe68a
<template lang="pug">
v-card.h-event.event.d-flex
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
.title.p-name {{event.title}}
......@@ -32,7 +31,16 @@
v-icon mdi-calendar-export
v-list-item-content
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>
<script>
import { mapState } from 'vuex'
......@@ -41,6 +49,24 @@ export default {
props: {
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>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment