2019-01-21 15:08:22 +01:00
|
|
|
<template>
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-image" v-if="!event.image">
|
2019-03-21 20:23:42 +01:00
|
|
|
<figure class="image is-16by9">
|
|
|
|
<img src="https://picsum.photos/g/400/225/?random">
|
2019-01-21 15:08:22 +01:00
|
|
|
</figure>
|
|
|
|
</div>
|
|
|
|
<div class="card-content">
|
|
|
|
<div class="content">
|
|
|
|
<router-link :to="{ name: 'Event', params:{ uuid: event.uuid } }">
|
|
|
|
<h2 class="title">{{ event.title }}</h2>
|
|
|
|
</router-link>
|
2019-03-21 20:23:42 +01:00
|
|
|
<DateComponent v-if="!options.hideDate" :date="event.beginsOn" />
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2019-03-21 20:23:42 +01:00
|
|
|
<div v-if="!options.hideDetails">
|
|
|
|
<div v-if="event.participants.length > 0 &&
|
|
|
|
options.loggedPerson &&
|
|
|
|
event.participants[0].actor.id === options.loggedPerson.id">
|
|
|
|
<b-tag type="is-info"><translate>Organizer</translate></b-tag>
|
|
|
|
</div>
|
|
|
|
<div v-else-if="event.participants.length === 1">
|
2019-01-21 15:08:22 +01:00
|
|
|
<translate
|
2019-03-21 20:23:42 +01:00
|
|
|
:translate-params="{name: event.participants[0].actor.preferredUsername}"
|
2019-01-21 15:08:22 +01:00
|
|
|
>%{name} organizes this event</translate>
|
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<span v-for="participant in event.participants" :key="participant.actor.uuid">
|
|
|
|
{{ participant.actor.preferredUsername }}
|
2019-02-07 16:37:40 +01:00
|
|
|
<span v-if="participant.role === ParticipantRole.CREATOR">(organizer)</span>,
|
2019-01-21 15:08:22 +01:00
|
|
|
<!-- <translate
|
|
|
|
:translate-params="{name: participant.actor.preferredUsername}"
|
|
|
|
> %{name} is in,</translate>-->
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2019-03-22 10:57:14 +01:00
|
|
|
import { IEvent, ParticipantRole } from '@/types/event.model';
|
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
2019-03-21 20:23:42 +01:00
|
|
|
import DateComponent from '@/components/Event/Date.vue';
|
2019-01-21 15:08:22 +01:00
|
|
|
|
2019-03-21 20:23:42 +01:00
|
|
|
@Component({
|
|
|
|
components: {
|
|
|
|
DateComponent,
|
|
|
|
EventCard,
|
|
|
|
},
|
|
|
|
})
|
2019-01-21 15:08:22 +01:00
|
|
|
export default class EventCard extends Vue {
|
|
|
|
@Prop({ required: true }) event!: IEvent;
|
2019-03-21 20:23:42 +01:00
|
|
|
@Prop({ default() { return { hideDate: false, loggedPerson: false, hideDetails: false }; } }) options!: object;
|
2019-02-07 16:37:40 +01:00
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2019-03-22 10:57:14 +01:00
|
|
|
ParticipantRole,
|
|
|
|
};
|
2019-02-07 16:37:40 +01:00
|
|
|
}
|
2019-01-21 15:08:22 +01:00
|
|
|
}
|
|
|
|
</script>
|