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> <template>
<div> <div>
<event-metadata-block <event-metadata-block
v-if="!event.options.isOnline"
:title="$t('Location')" :title="$t('Location')"
:icon="physicalAddress ? physicalAddress.poiInfos.poiIcon.icon : 'earth'" :icon="physicalAddress ? physicalAddress.poiInfos.poiIcon.icon : 'earth'"
> >

View file

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

View file

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

View file

@ -1202,5 +1202,6 @@
"{timezoneLongName} ({timezoneShortName})": "{timezoneLongName} ({timezoneShortName})", "{timezoneLongName} ({timezoneShortName})": "{timezoneLongName} ({timezoneShortName})",
"Back to top": "Back to top", "Back to top": "Back to top",
"Powered by Mobilizon": "Powered by Mobilizon", "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})", "{timezoneLongName} ({timezoneShortName})": "{timezoneLongName} ({timezoneShortName})",
"Back to top": "Retour en haut", "Back to top": "Retour en haut",
"Powered by Mobilizon": "Propulsé par Mobilizon", "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; showStartTime: boolean;
showEndTime: boolean; showEndTime: boolean;
timezone: string | null; timezone: string | null;
isOnline: boolean;
} }
export class EventOptions implements IEventOptions { export class EventOptions implements IEventOptions {
@ -57,4 +58,6 @@ export class EventOptions implements IEventOptions {
showEndTime = true; showEndTime = true;
timezone = null; timezone = null;
isOnline = false;
} }

View file

@ -81,10 +81,16 @@
{{ $t("Date parameters") }} {{ $t("Date parameters") }}
</b-button> </b-button>
<div class="address">
<full-address-auto-complete <full-address-auto-complete
v-model="eventPhysicalAddress" v-model="eventPhysicalAddress"
:user-timezone="userActualTimezone" :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"> <div class="field">
<label class="label">{{ $t("Description") }}</label> <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>
<style lang="scss"> <style lang="scss">
.dialog .modal-card { .dialog .modal-card {
@ -1288,5 +1303,16 @@ export default class EditEvent extends Vue {
} }
this.event.physicalAddress = address; this.event.physicalAddress = address;
} }
get isOnline(): boolean {
return this.event.options.isOnline;
}
set isOnline(isOnline: boolean) {
this.event.options = {
...this.event.options,
isOnline,
};
}
} }
</script> </script>

View file

@ -243,6 +243,8 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
description: description:
"Whether to show or hide the person organizer when event is organized by a group" "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 end
@desc """ @desc """
@ -294,6 +296,8 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
description: description:
"Whether to show or hide the person organizer when event is organized by a group" "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 end
enum :event_metadata_type do enum :event_metadata_type do

View file

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