Merge branch 'duplicate-event' into 'master'

add duplicate event

See merge request framasoft/mobilizon!426
This commit is contained in:
Thomas Citharel 2020-06-04 10:25:37 +02:00
commit 40b23f4aa2
9 changed files with 92 additions and 15 deletions

View File

@ -98,6 +98,20 @@
>{{ $t("Edit") }}</b-button
>
</li>
<li>
<b-button
type="is-text"
@click="
gotToWithCheck(participation, {
name: RouteName.DUPLICATE_EVENT,
params: { eventId: participation.event.uuid },
})
"
icon-left="content-duplicate"
>
{{ $t("Duplicate") }}
</b-button>
</li>
<li
v-if="
![ParticipantRole.PARTICIPANT, ParticipantRole.NOT_APPROVED].includes(

View File

@ -567,5 +567,22 @@
"List title": "List title",
"Create a new list": "Create a new list",
"Your timezone is currently set to {timezone}.": "Your timezone is currently set to {timezone}.",
"Timezone detected as {timezone}.": "Timezone detected as {timezone}."
"Timezone detected as {timezone}.": "Timezone detected as {timezone}.",
"Bold": "Bold",
"Italic": "Italic",
"Duplicate": "Duplicate",
"Home": "Home",
"Important event updates": "Important event updates",
"Like title update, start or end date change, event being confirmed or cancelled.": "Like title update, start or end date change, event being confirmed or cancelled.",
"Notification on the day of the event": "Notification on the day of the event",
"We'll use your timezone settings to send a recap of the morning of the event.": "We'll use your timezone settings to send a recap of the morning of the event.",
"You can pick your timezone into your preferences.": "You can pick your timezone into your preferences.",
"Recap every week": "Recap every week",
"You'll get a weekly recap every Monday for upcoming events, if you have any.": "You'll get a weekly recap every Monday for upcoming events, if you have any.",
"Notification before the event": "Notification before the event",
"We'll send you an email one hour before the event begins, to be sure you won't forget about it.": "We'll send you an email one hour before the event begins, to be sure you won't forget about it.",
"Timezone": "Timezone",
"Select a timezone": "Select a timezone",
"Other": "Other",
"No moderation logs yet": "No moderation logs yet"
}

View File

@ -570,5 +570,24 @@
"Task lists": "Listes de tâches",
"Add a todo": "Ajouter un todo",
"List title": "Titre de la liste",
"Create a new list": "Créer une nouvelle liste"
"Create a new list": "Créer une nouvelle liste",
"Timezone detected as {timezone}.": "Fuseau horaire détecté en tant que {timezone}.",
"Your timezone is currently set to {timezone}.": "Votre fuseau horaire est actuellement défini à {timezone}.",
"Bold": "Gras",
"Italic": "Italique",
"Duplicate": "Dupliquer",
"Home": "Accueil",
"Important event updates": "Mises à jour importantes des événements",
"Like title update, start or end date change, event being confirmed or cancelled.": "Comme le changement du titre de l'événement, de sa date de début ou de fin, ou bien qu'il soit confirmé ou bien annulé.",
"Notification on the day of the event": "Notification le jour de l'événement",
"We'll use your timezone settings to send a recap of the morning of the event.": "Nous prendrons en compte votre fuseau horaire pour vous envoyer un récapitulatif de vos événements le matin.",
"You can pick your timezone into your preferences.": "Vous pouvez choisir votre fuseau horaire dans vos préférences.",
"Recap every week": "Récapitulatif hebdomadaire",
"You'll get a weekly recap every Monday for upcoming events, if you have any.": "Vous recevrez un récapitulatif hebdomadaire chaque lundi pour les événements de la semaine, si vous en avez.",
"Notification before the event": "Notification avant l'événement",
"We'll send you an email one hour before the event begins, to be sure you won't forget about it.": "Nous vous enverrons un email une heure avant que l'événement débute, pour être sûr que vous ne l'oubliez pas.",
"Timezone": "Fuseau horaire",
"Select a timezone": "Selectionnez un fuseau horaire",
"Other": "Autre",
"No moderation logs yet": "Pas encore de journaux de modération"
}

View File

@ -1,4 +1,4 @@
import { RouteConfig } from "vue-router";
import { RouteConfig, Route } from "vue-router";
import EventList from "../views/Event/EventList.vue";
import Location from "../views/Location.vue";
@ -15,6 +15,7 @@ export enum EventRouteName {
MY_EVENTS = "MyEvents",
EXPLORE = "Explore",
EDIT_EVENT = "EditEvent",
DUPLICATE_EVENT = "DuplicateEvent",
PARTICIPATIONS = "Participations",
EVENT = "Event",
EVENT_PARTICIPATE_WITH_ACCOUNT = "EVENT_PARTICIPATE_WITH_ACCOUNT",
@ -55,7 +56,14 @@ export const eventRoutes: RouteConfig[] = [
name: EventRouteName.EDIT_EVENT,
component: editEvent,
meta: { requiredAuth: true },
props: true,
props: (route: Route) => ({ ...route.params, ...{ isUpdate: true } }),
},
{
path: "/events/duplicate/:eventId",
name: EventRouteName.DUPLICATE_EVENT,
component: editEvent,
meta: { requiredAuth: true },
props: (route: Route) => ({ ...route.params, ...{ isDuplicate: true } }),
},
{
path: "/events/:eventId/participations",

View File

@ -1,8 +1,12 @@
<template>
<section>
<div class="container">
<h1 class="title" v-if="isUpdate === false">{{ $t("Create a new event") }}</h1>
<h1 class="title" v-else>{{ $t("Update event {name}", { name: event.title }) }}</h1>
<h1 class="title" v-if="isUpdate === true">
{{ $t("Update event {name}", { name: event.title }) }}
</h1>
<h1 class="title" v-else>
{{ $t("Create a new event") }}
</h1>
<form ref="form">
<subtitle>{{ $t("General information") }}</subtitle>
@ -404,6 +408,10 @@ const DEFAULT_LIMIT_NUMBER_OF_PLACES = 10;
export default class EditEvent extends Vue {
@Prop({ required: false, type: String }) eventId: undefined | string;
@Prop({ type: Boolean, default: false }) isUpdate!: boolean;
@Prop({ type: Boolean, default: false }) isDuplicate!: boolean;
currentActor = new Person();
tags: ITag[] = [];
@ -441,10 +449,6 @@ export default class EditEvent extends Vue {
this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON()));
}
get isUpdate(): boolean {
return this.eventId !== undefined;
}
@Watch("eventId", { immediate: true })
resetFormForCreation(eventId: string) {
if (eventId === undefined) {
@ -491,7 +495,7 @@ export default class EditEvent extends Vue {
createOrUpdateDraft(e: Event) {
e.preventDefault();
if (this.validateForm()) {
if (this.eventId) return this.updateEvent();
if (this.eventId && !this.isDuplicate) return this.updateEvent();
return this.createEvent();
}
@ -716,6 +720,11 @@ export default class EditEvent extends Vue {
if (result.data.event.endsOn === null) {
this.endsOnNull = true;
}
// as stated here : https://github.com/elixir-ecto/ecto/issues/1684
// "Ecto currently silently transforms empty strings into nil"
if (result.data.event.description === null) {
result.data.event.description = "";
}
return new EventModel(result.data.event);
}

View File

@ -230,6 +230,18 @@
<b-icon icon="pencil" />
</router-link>
</b-dropdown-item>
<b-dropdown-item
aria-role="listitem"
has-link
v-if="actorIsOrganizer || event.draft"
>
<router-link
:to="{ name: RouteName.DUPLICATE_EVENT, params: { eventId: event.uuid } }"
>
{{ $t("Duplicate") }}
<b-icon icon="content-duplicate" />
</router-link>
</b-dropdown-item>
<b-dropdown-item
aria-role="listitem"
v-if="actorIsOrganizer || event.draft"

View File

@ -42,7 +42,7 @@
</li>
</ul>
<div v-else>
<b-message type="is-info">No moderation logs yet</b-message>
<b-message type="is-info">{{ $t('No moderation logs yet') }}</b-message>
</div>
</section>
</template>

View File

@ -1,6 +1,5 @@
<template>
<div v-if="loggedUser">
<h2 class="subtitle">{{ $t("No notification settings yet") }}</h2>
<div class="field">
<b-checkbox disabled v-model="notificationEventUpdates">
<strong>{{ $t("Important event updates") }}</strong>

View File

@ -1,6 +1,5 @@
<template>
<div>
<h2 class="subtitle">{{ $t("No preferences yet") }}</h2>
<b-field :label="$t('Timezone')">
<b-select
:placeholder="$t('Select a timezone')"