Add isOnline event option to mark event as fully online

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-10-15 15:59:49 +02:00
parent d2ccc21f91
commit 7ecf2e1da0
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
9 changed files with 52 additions and 10 deletions

View File

@ -1,6 +1,7 @@
<template>
<div>
<event-metadata-block
v-if="!event.options.isOnline"
:title="$t('Location')"
:icon="physicalAddress ? physicalAddress.poiInfos.poiIcon.icon : 'earth'"
>

View File

@ -34,6 +34,7 @@
@select="updateSelected"
v-bind="$attrs"
:id="id"
:disabled="disabled"
>
<template #default="{ option }">
<b-icon :icon="option.poiInfos.poiIcon.icon" />
@ -156,6 +157,7 @@ export default class FullAddressAutoComplete extends Mixins(
) {
@Prop({ required: false, default: "" }) label!: string;
@Prop({ required: false }) userTimezone!: string;
@Prop({ required: false, default: false, type: Boolean }) disabled!: boolean;
addressModalActive = false;

View File

@ -62,6 +62,7 @@ const EVENT_OPTIONS_FRAGMENT = gql`
commentModeration
showParticipationPrice
hideOrganizerWhenGroupEvent
isOnline
}
`;

View File

@ -1202,5 +1202,6 @@
"{timezoneLongName} ({timezoneShortName})": "{timezoneLongName} ({timezoneShortName})",
"Back to top": "Back to top",
"Powered by Mobilizon": "Powered by Mobilizon",
"Instance follows": "Instance follows"
"Instance follows": "Instance follows",
"The event is fully online": "The event is fully online"
}

View File

@ -1308,5 +1308,6 @@
"{timezoneLongName} ({timezoneShortName})": "{timezoneLongName} ({timezoneShortName})",
"Back to top": "Retour en haut",
"Powered by Mobilizon": "Propulsé par Mobilizon",
"Instance follows": "Abonnements de l'instance"
"Instance follows": "Abonnements de l'instance",
"The event is fully online": "L'événement est entièrement en ligne"
}

View File

@ -27,6 +27,7 @@ export interface IEventOptions {
showStartTime: boolean;
showEndTime: boolean;
timezone: string | null;
isOnline: boolean;
}
export class EventOptions implements IEventOptions {
@ -57,4 +58,6 @@ export class EventOptions implements IEventOptions {
showEndTime = true;
timezone = null;
isOnline = false;
}

View File

@ -81,10 +81,16 @@
{{ $t("Date parameters") }}
</b-button>
<full-address-auto-complete
v-model="eventPhysicalAddress"
:user-timezone="userActualTimezone"
/>
<div class="address">
<full-address-auto-complete
v-model="eventPhysicalAddress"
:user-timezone="userActualTimezone"
:disabled="isOnline"
/>
<b-switch class="is-online" v-model="isOnline">{{
$t("The event is fully online")
}}</b-switch>
</div>
<div class="field">
<label class="label">{{ $t("Description") }}</label>
@ -536,6 +542,15 @@ section {
}
}
}
.address {
::v-deep .address-autocomplete {
margin-bottom: 0 !important;
}
.is-online {
margin-bottom: 10px;
}
}
</style>
<style lang="scss">
.dialog .modal-card {
@ -1288,5 +1303,16 @@ export default class EditEvent extends Vue {
}
this.event.physicalAddress = address;
}
get isOnline(): boolean {
return this.event.options.isOnline;
}
set isOnline(isOnline: boolean) {
this.event.options = {
...this.event.options,
isOnline,
};
}
}
</script>

View File

@ -243,6 +243,8 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
description:
"Whether to show or hide the person organizer when event is organized by a group"
)
field(:is_online, :boolean, description: "Whether the event is fully online")
end
@desc """
@ -294,6 +296,8 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
description:
"Whether to show or hide the person organizer when event is organized by a group"
)
field(:is_online, :boolean, description: "Whether the event is fully online")
end
enum :event_metadata_type do

View File

@ -28,7 +28,8 @@ defmodule Mobilizon.Events.EventOptions do
show_start_time: boolean,
show_end_time: boolean,
timezone: String.t() | nil,
hide_organizer_when_group_event: boolean
hide_organizer_when_group_event: boolean,
is_online: boolean()
}
@attrs [
@ -43,7 +44,8 @@ defmodule Mobilizon.Events.EventOptions do
:show_start_time,
:show_end_time,
:timezone,
:hide_organizer_when_group_event
:hide_organizer_when_group_event,
:is_online
]
@primary_key false
@ -61,6 +63,7 @@ defmodule Mobilizon.Events.EventOptions do
field(:show_end_time, :boolean, default: true)
field(:timezone, :string)
field(:hide_organizer_when_group_event, :boolean, default: false)
field(:is_online, :boolean, default: false)
embeds_many(:offers, EventOffer)
embeds_many(:participation_condition, EventParticipationCondition)