2019-01-21 15:08:22 +01:00
|
|
|
<template>
|
2019-04-03 17:29:03 +02:00
|
|
|
<router-link class="card" :to="{ name: 'Event', params: { uuid: event.uuid } }">
|
2019-01-21 15:08:22 +01:00
|
|
|
<div class="card-image" v-if="!event.image">
|
2019-03-21 20:23:42 +01:00
|
|
|
<figure class="image is-16by9">
|
2019-05-22 14:12:11 +02:00
|
|
|
<div class="tag-container" v-if="event.tags">
|
2019-04-24 20:49:52 +02:00
|
|
|
<b-tag v-for="tag in event.tags.slice(0, 3)" :key="tag.slug" type="is-secondary">{{ tag.title }}</b-tag>
|
|
|
|
</div>
|
2019-09-09 09:31:08 +02:00
|
|
|
<img src="https://picsum.photos/g/400/225/?random" />
|
2019-01-21 15:08:22 +01:00
|
|
|
</figure>
|
|
|
|
</div>
|
2019-04-03 17:29:03 +02:00
|
|
|
<div class="content">
|
|
|
|
<div class="title-wrapper">
|
|
|
|
<div class="date-component">
|
|
|
|
<date-calendar-icon v-if="!mergedOptions.hideDate" :date="event.beginsOn" />
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2019-04-03 17:29:03 +02:00
|
|
|
<h2 class="title" ref="title">{{ event.title }}</h2>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2019-10-02 17:59:07 +02:00
|
|
|
<span class="organizer-place-wrapper">
|
2019-09-20 19:43:29 +02:00
|
|
|
<span v-if="actorDisplayName && actorDisplayName !== '@'">{{ $t('By {name}', { name: actorDisplayName }) }}</span>
|
|
|
|
<span v-if="event.physicalAddress && (event.physicalAddress.locality || event.physicalAddress.description)">
|
|
|
|
- {{ event.physicalAddress.locality || event.physicalAddress.description }}
|
|
|
|
</span>
|
2019-04-03 17:29:03 +02:00
|
|
|
</span>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2019-04-03 17:29:03 +02:00
|
|
|
<!-- <div v-if="!mergedOptions.hideDetails" class="details">-->
|
|
|
|
<!-- <div v-if="event.participants.length > 0 &&-->
|
|
|
|
<!-- mergedOptions.loggedPerson &&-->
|
|
|
|
<!-- event.participants[0].actor.id === mergedOptions.loggedPerson.id">-->
|
|
|
|
<!-- <b-tag type="is-info"><translate>Organizer</translate></b-tag>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- <div v-else-if="event.participants.length === 1">-->
|
|
|
|
<!-- <translate-->
|
|
|
|
<!-- :translate-params="{name: event.participants[0].actor.preferredUsername}"-->
|
2019-09-12 11:34:01 +02:00
|
|
|
<!-- >{name} organizes this event</translate>-->
|
2019-04-03 17:29:03 +02:00
|
|
|
<!-- </div>-->
|
|
|
|
<!-- <div v-else>-->
|
|
|
|
<!-- <span v-for="participant in event.participants" :key="participant.actor.uuid">-->
|
|
|
|
<!-- {{ participant.actor.preferredUsername }}-->
|
|
|
|
<!-- <span v-if="participant.role === ParticipantRole.CREATOR">(organizer)</span>,-->
|
|
|
|
<!-- <!– <translate-->
|
|
|
|
<!-- :translate-params="{name: participant.actor.preferredUsername}"-->
|
2019-09-12 11:34:01 +02:00
|
|
|
<!-- > {name} is in,</translate>–>-->
|
2019-04-03 17:29:03 +02:00
|
|
|
<!-- </span>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
</router-link>
|
2019-01-21 15:08:22 +01:00
|
|
|
</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-04-03 17:29:03 +02:00
|
|
|
import DateCalendarIcon from '@/components/Event/DateCalendarIcon.vue';
|
2019-04-26 15:22:16 +02:00
|
|
|
import { IActor, IPerson, Person } from '@/types/actor';
|
2019-04-03 17:29:03 +02:00
|
|
|
const lineClamp = require('line-clamp');
|
|
|
|
|
|
|
|
export interface IEventCardOptions {
|
|
|
|
hideDate: boolean;
|
|
|
|
loggedPerson: IPerson | boolean;
|
|
|
|
hideDetails: boolean;
|
|
|
|
organizerActor: IActor | null;
|
|
|
|
}
|
2019-01-21 15:08:22 +01:00
|
|
|
|
2019-03-21 20:23:42 +01:00
|
|
|
@Component({
|
|
|
|
components: {
|
2019-04-03 17:29:03 +02:00
|
|
|
DateCalendarIcon,
|
2019-03-21 20:23:42 +01:00
|
|
|
},
|
2019-04-03 17:29:03 +02:00
|
|
|
mounted() {
|
|
|
|
lineClamp(this.$refs.title, 3);
|
|
|
|
},
|
2019-03-21 20:23:42 +01:00
|
|
|
})
|
2019-01-21 15:08:22 +01:00
|
|
|
export default class EventCard extends Vue {
|
|
|
|
@Prop({ required: true }) event!: IEvent;
|
2019-04-03 17:29:03 +02:00
|
|
|
@Prop({ required: false }) options!: IEventCardOptions;
|
|
|
|
|
|
|
|
ParticipantRole = ParticipantRole;
|
|
|
|
|
|
|
|
defaultOptions: IEventCardOptions = {
|
|
|
|
hideDate: false,
|
|
|
|
loggedPerson: false,
|
|
|
|
hideDetails: false,
|
|
|
|
organizerActor: null,
|
|
|
|
};
|
|
|
|
|
|
|
|
get mergedOptions(): IEventCardOptions {
|
|
|
|
return { ...this.defaultOptions, ...this.options };
|
|
|
|
}
|
2019-02-07 16:37:40 +01:00
|
|
|
|
2019-04-24 20:49:52 +02:00
|
|
|
get actorDisplayName(): string {
|
2019-04-03 17:29:03 +02:00
|
|
|
const actor = Object.assign(new Person(), this.event.organizerActor || this.mergedOptions.organizerActor);
|
|
|
|
return actor.displayName();
|
2019-02-07 16:37:40 +01:00
|
|
|
}
|
2019-04-03 17:29:03 +02:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
}
|
|
|
|
</script>
|
2019-04-03 17:29:03 +02:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import "../../variables";
|
|
|
|
|
|
|
|
a.card {
|
|
|
|
border: none;
|
|
|
|
background: $secondary;
|
|
|
|
|
2019-04-24 20:49:52 +02:00
|
|
|
div.tag-container {
|
|
|
|
position: absolute;
|
|
|
|
top: 10px;
|
|
|
|
right: 0;
|
|
|
|
margin-right: -5px;
|
|
|
|
z-index: 10;
|
|
|
|
max-width: 40%;
|
|
|
|
|
|
|
|
span.tag {
|
|
|
|
margin: 5px auto;
|
|
|
|
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 1);
|
|
|
|
/*word-break: break-all;*/
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
display: block;
|
|
|
|
/*text-align: right;*/
|
|
|
|
font-size: 1em;
|
|
|
|
/*padding: 0 1px;*/
|
|
|
|
line-height: 1.75em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-03 17:29:03 +02:00
|
|
|
div.card-image {
|
|
|
|
background: $secondary;
|
|
|
|
}
|
|
|
|
|
|
|
|
div.content {
|
|
|
|
padding: 5px;
|
|
|
|
background: $secondary;
|
|
|
|
|
|
|
|
div.title-wrapper {
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
div.date-component {
|
|
|
|
flex: 0;
|
|
|
|
margin-right: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
|
|
|
font-weight: 400;
|
|
|
|
line-height: 1em;
|
|
|
|
font-size: 1.6em;
|
|
|
|
padding-bottom: 5px;
|
2019-10-02 17:59:07 +02:00
|
|
|
margin-top: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
span.organizer-place-wrapper {
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
span:last-child {
|
|
|
|
flex: 1;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2019-04-03 17:29:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|