gancio/components/Event.vue

69 lines
2.2 KiB
Vue
Raw Normal View History

2019-04-03 00:25:12 +02:00
<template lang="pug">
2020-06-22 19:15:32 +02:00
.card.event.h-event.mt-1.text-white
2020-02-09 18:15:44 +01:00
nuxt-link(:to='`/event/${event.id}`')
2020-02-21 18:10:21 +01:00
el-image(v-if='showImage && event.image_path'
lazy :src='`/media/thumb/${event.image_path}`')
2020-02-09 18:15:44 +01:00
.float-right
i.text-danger.el-icon-refresh(v-if='event.parentId')
.badge.text-info(v-if='settings.enable_resources && event.resources && event.resources.length') {{event.resources.length}}
2020-06-22 19:15:32 +02:00
//- title
2020-02-11 11:53:32 +01:00
.p-name.p-summary.title {{event.title}}
2020-02-09 18:15:44 +01:00
.card-body
2020-07-09 02:27:17 +02:00
//- div.d-flex.justify-content-between
//- when
time.d-block.dt-start.mt-0(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")') <i class='el-icon-date'/> {{event|when}}
//- place
.p-location.mt-1.text-warning(plain size='mini' round type='text' @click='addPlace') <i class='el-icon-location-outline'/> {{event.place.name}}
2020-02-11 15:39:57 +01:00
//- description
2020-07-09 02:27:17 +02:00
//- .p-description.description.mt-3(v-html='description')
2020-02-09 18:15:44 +01:00
.card-footer(v-if='event.tags.length')
2020-07-09 02:27:17 +02:00
el-button.ml-1(type='text' plain round size='mini' v-for='tag in event.tags' :key='tag' @click='addTag(tag)') {{tag}}
2019-04-03 00:25:12 +02:00
</template>
<script>
2020-02-09 18:15:44 +01:00
import { mapState, mapActions } from 'vuex'
2019-04-03 00:25:12 +02:00
export default {
2019-05-30 12:04:14 +02:00
props: {
event: { type: Object, default: () => ({}) },
2019-05-30 12:04:14 +02:00
showTags: {
type: Boolean,
default: true
},
showImage: {
type: Boolean,
default: true
2019-09-11 19:12:24 +02:00
}
2019-04-03 00:25:12 +02:00
},
2019-05-30 12:04:14 +02:00
computed: {
2020-02-09 18:15:44 +01:00
...mapState(['settings', 'filters']),
description () {
2020-06-22 19:15:32 +02:00
return this.event.description.replace(/(<br>)+/g, '<br>')
2020-02-09 18:15:44 +01:00
},
show_footer () {
return (this.event.tags.length || this.event.resources.length)
}
},
methods: {
...mapActions(['setSearchTags', 'setSearchPlaces']),
addTag (tag) {
if (this.filters.tags.includes(tag)) {
this.setSearchTags(this.filters.tags.filter(t => t !== tag))
} else {
this.setSearchTags(this.filters.tags.concat([tag]))
}
},
addPlace () {
const place = this.event.place.id
if (this.filters.places.includes(place)) {
this.setSearchPlaces(this.filters.places.filter(p => p !== place))
} else {
this.setSearchPlaces(this.filters.places.concat(place))
}
}
2019-04-03 00:25:12 +02:00
}
}
</script>