forked from potsda.mn/mobilizon
Merge branch 'show-cancelled-status' into 'master'
Show cancelled status Closes #478 See merge request framasoft/mobilizon!736
This commit is contained in:
commit
01c86a1cb9
|
@ -10,7 +10,16 @@
|
||||||
event.picture ? event.picture.url : '/img/mobilizon_default_card.png'
|
event.picture ? event.picture.url : '/img/mobilizon_default_card.png'
|
||||||
}')`"
|
}')`"
|
||||||
>
|
>
|
||||||
<div class="tag-container" v-if="event.tags">
|
<div
|
||||||
|
class="tag-container"
|
||||||
|
v-if="event.tags || event.status !== EventStatus.CONFIRMED"
|
||||||
|
>
|
||||||
|
<b-tag type="is-info" v-if="event.status === EventStatus.TENTATIVE">
|
||||||
|
{{ $t("Tentative") }}
|
||||||
|
</b-tag>
|
||||||
|
<b-tag type="is-danger" v-if="event.status === EventStatus.CANCELLED">
|
||||||
|
{{ $t("Cancelled") }}
|
||||||
|
</b-tag>
|
||||||
<router-link
|
<router-link
|
||||||
:to="{ name: RouteName.TAG, params: { tag: tag.title } }"
|
:to="{ name: RouteName.TAG, params: { tag: tag.title } }"
|
||||||
v-for="tag in event.tags.slice(0, 3)"
|
v-for="tag in event.tags.slice(0, 3)"
|
||||||
|
@ -84,7 +93,7 @@ import { IEvent, IEventCardOptions } from "@/types/event.model";
|
||||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||||
import DateCalendarIcon from "@/components/Event/DateCalendarIcon.vue";
|
import DateCalendarIcon from "@/components/Event/DateCalendarIcon.vue";
|
||||||
import { Actor, Person } from "@/types/actor";
|
import { Actor, Person } from "@/types/actor";
|
||||||
import { ParticipantRole } from "@/types/enums";
|
import { EventStatus, ParticipantRole } from "@/types/enums";
|
||||||
import RouteName from "../../router/name";
|
import RouteName from "../../router/name";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -99,6 +108,8 @@ export default class EventCard extends Vue {
|
||||||
|
|
||||||
ParticipantRole = ParticipantRole;
|
ParticipantRole = ParticipantRole;
|
||||||
|
|
||||||
|
EventStatus = EventStatus;
|
||||||
|
|
||||||
RouteName = RouteName;
|
RouteName = RouteName;
|
||||||
|
|
||||||
defaultOptions: IEventCardOptions = {
|
defaultOptions: IEventCardOptions = {
|
||||||
|
|
|
@ -110,15 +110,7 @@
|
||||||
v-if="new Date(endDate) > new Date()"
|
v-if="new Date(endDate) > new Date()"
|
||||||
>
|
>
|
||||||
<participation-button
|
<participation-button
|
||||||
v-if="
|
v-if="shouldShowParticipationButton"
|
||||||
anonymousParticipation === null &&
|
|
||||||
(config.anonymous.participation.allowed ||
|
|
||||||
(currentActor.id &&
|
|
||||||
!actorIsOrganizer &&
|
|
||||||
!event.draft &&
|
|
||||||
(eventCapacityOK || actorIsParticipant) &&
|
|
||||||
event.status !== EventStatus.CANCELLED))
|
|
||||||
"
|
|
||||||
:participation="participations[0]"
|
:participation="participations[0]"
|
||||||
:event="event"
|
:event="event"
|
||||||
:current-actor="currentActor"
|
:current-actor="currentActor"
|
||||||
|
@ -949,6 +941,7 @@ export default class Event extends EventMixin {
|
||||||
mutation: JOIN_EVENT,
|
mutation: JOIN_EVENT,
|
||||||
variables: {
|
variables: {
|
||||||
eventId: this.event.id,
|
eventId: this.event.id,
|
||||||
|
actorId: identity.id,
|
||||||
message,
|
message,
|
||||||
},
|
},
|
||||||
update: (store, { data }) => {
|
update: (store, { data }) => {
|
||||||
|
@ -1205,6 +1198,29 @@ export default class Event extends EventMixin {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get shouldShowParticipationButton(): boolean {
|
||||||
|
// So that people can cancel their participation
|
||||||
|
if (
|
||||||
|
this.actorIsParticipant ||
|
||||||
|
(this.config.anonymous.participation.allowed &&
|
||||||
|
this.anonymousParticipation)
|
||||||
|
)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// You can participate to draft or cancelled events
|
||||||
|
if (this.event.draft || this.event.status === EventStatus.CANCELLED)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Organizer can't participate
|
||||||
|
if (this.actorIsOrganizer) return false;
|
||||||
|
|
||||||
|
// If capacity is OK
|
||||||
|
if (this.eventCapacityOK) return true;
|
||||||
|
|
||||||
|
// Else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in a new issue