2021-03-16 19:57:34 +01:00
|
|
|
<template lang="pug">
|
2022-01-24 14:12:41 +01:00
|
|
|
v-card.h-event.event.d-flex(itemscope itemtype="https://schema.org/Event")
|
|
|
|
nuxt-link(:to='`/event/${event.slug || event.id}`' itemprop="url")
|
2022-02-04 22:35:15 +01:00
|
|
|
img.img.u-featured(:src='thumbnail' :alt='alt' :loading='this.lazy?"lazy":"eager"' itemprop="image" :style="{ 'object-position': thumbnailPosition }")
|
2021-03-16 19:57:34 +01:00
|
|
|
v-icon.float-right.mr-1(v-if='event.parentId' color='success') mdi-repeat
|
2022-01-24 14:12:41 +01:00
|
|
|
.title.p-name(itemprop="name") {{event.title}}
|
2020-10-07 13:03:15 +02:00
|
|
|
|
2021-03-08 14:39:18 +01:00
|
|
|
v-card-text.body.pt-0.pb-0
|
2022-01-24 14:12:41 +01:00
|
|
|
time.dt-start.subtitle-1(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")' itemprop="startDate" :content="event.start_datetime|unixFormat('YYYY-MM-DDTHH:mm')") <v-icon>mdi-calendar</v-icon> {{ event|when }}
|
|
|
|
.d-none.dt-end(itemprop="endDate" :content="event.end_datetime|unixFormat('YYYY-MM-DDTHH:mm')") {{event.end_datetime|unixFormat('YYYY-MM-DD HH:mm')}}
|
2022-01-25 01:30:25 +01:00
|
|
|
a.place.d-block.p-location.pl-0(text color='primary' @click="$emit('placeclick', event.place.id)" itemprop="location" :content="event.place.name") <v-icon>mdi-map-marker</v-icon> {{event.place.name}}
|
2022-02-04 22:35:15 +01:00
|
|
|
.d-none(itemprop='location.address') {{event.place.address}}
|
2020-10-25 00:30:28 +02:00
|
|
|
|
2021-05-20 10:48:20 +02:00
|
|
|
v-card-actions.pt-0.actions.justify-space-between
|
2021-03-05 14:21:01 +01:00
|
|
|
.tags
|
2021-05-20 10:48:20 +02:00
|
|
|
v-chip.ml-1.mt-1(v-for='tag in event.tags.slice(0,6)' small
|
2021-03-16 19:57:34 +01:00
|
|
|
:key='tag' outlined color='primary' @click="$emit('tagclick', tag)") {{tag}}
|
2020-10-07 13:03:15 +02:00
|
|
|
|
2021-01-22 21:14:41 +01:00
|
|
|
v-menu(offset-y)
|
|
|
|
template(v-slot:activator="{on}")
|
2021-12-02 12:43:53 +01:00
|
|
|
v-btn.align-self-end(icon v-on='on' color='primary' alt='more')
|
2021-01-22 21:14:41 +01:00
|
|
|
v-icon mdi-dots-vertical
|
|
|
|
v-list(dense)
|
|
|
|
v-list-item-group
|
2021-12-06 15:58:12 +01:00
|
|
|
v-list-item(@click='clipboard(`${settings.baseurl}/event/${event.slug || event.id}`)')
|
2021-01-22 21:14:41 +01:00
|
|
|
v-list-item-icon
|
|
|
|
v-icon mdi-content-copy
|
|
|
|
v-list-item-content
|
2021-03-16 19:57:34 +01:00
|
|
|
v-list-item-title {{$t('common.copy_link')}}
|
2021-07-27 17:19:23 +02:00
|
|
|
v-list-item(:href='`/api/event/${event.slug || event.id}.ics`')
|
2021-01-22 21:14:41 +01:00
|
|
|
v-list-item-icon
|
|
|
|
v-icon mdi-calendar-export
|
|
|
|
v-list-item-content
|
2021-03-16 19:57:34 +01:00
|
|
|
v-list-item-title {{$t('common.add_to_calendar')}}
|
2021-06-06 23:59:12 +02:00
|
|
|
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')}}
|
2019-04-03 00:25:12 +02:00
|
|
|
</template>
|
|
|
|
<script>
|
2021-03-16 19:57:34 +01:00
|
|
|
import { mapState } from 'vuex'
|
2021-12-06 15:58:12 +01:00
|
|
|
import clipboard from '../assets/clipboard'
|
2019-04-03 00:25:12 +02:00
|
|
|
|
|
|
|
export default {
|
2019-05-30 12:04:14 +02:00
|
|
|
props: {
|
2022-02-04 22:35:15 +01:00
|
|
|
event: { type: Object, default: () => ({}) },
|
|
|
|
lazy: Boolean
|
2021-03-16 19:57:34 +01:00
|
|
|
},
|
2021-12-06 15:58:12 +01:00
|
|
|
mixins: [clipboard],
|
2021-06-06 23:59:12 +02:00
|
|
|
computed: {
|
|
|
|
...mapState(['settings']),
|
2021-07-15 16:18:56 +02:00
|
|
|
thumbnail () {
|
|
|
|
let path
|
|
|
|
if (this.event.media && this.event.media.length) {
|
2021-07-26 12:23:02 +02:00
|
|
|
path = '/media/thumb/' + this.event.media[0].url
|
2021-07-15 16:18:56 +02:00
|
|
|
} else {
|
2021-07-26 12:23:02 +02:00
|
|
|
path = '/noimg.svg'
|
2021-07-15 16:18:56 +02:00
|
|
|
}
|
2021-07-26 12:23:02 +02:00
|
|
|
return path
|
2021-07-15 16:18:56 +02:00
|
|
|
},
|
2021-12-02 12:43:53 +01:00
|
|
|
alt () {
|
|
|
|
return this.event.media && this.event.media.length ? this.event.media[0].name : ''
|
|
|
|
},
|
2021-07-15 16:18:56 +02:00
|
|
|
thumbnailPosition () {
|
|
|
|
if (this.event.media && this.event.media.length && this.event.media[0].focalpoint) {
|
|
|
|
const focalpoint = this.event.media[0].focalpoint
|
|
|
|
return `${(focalpoint[0] + 1) * 50}% ${(focalpoint[1] + 1) * 50}%`
|
|
|
|
}
|
|
|
|
return 'center center'
|
|
|
|
},
|
2021-06-06 23:59:12 +02:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
2019-04-03 00:25:12 +02:00
|
|
|
}
|
2021-04-13 18:04:53 +02:00
|
|
|
</script>
|