From 55f854f3bc24511c8c8335244cdc6e1e420d82b2 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 7 Jun 2019 17:19:30 +0200 Subject: [PATCH] Improved event form creation date & timepickers Signed-off-by: Thomas Citharel --- js/src/components/Editor.vue | 1 - js/src/components/Event/DateTimePicker.vue | 33 ++++++++++++++++++++++ js/src/views/Event/Create.vue | 18 +++++++++--- 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 js/src/components/Event/DateTimePicker.vue diff --git a/js/src/components/Editor.vue b/js/src/components/Editor.vue index afb05a604..77ed7cbec 100644 --- a/js/src/components/Editor.vue +++ b/js/src/components/Editor.vue @@ -495,7 +495,6 @@ export default class CreateEvent extends Vue { .editor { position: relative; - max-width: 30rem; margin: 0 0 1rem; p.is-empty:first-child::before { diff --git a/js/src/components/Event/DateTimePicker.vue b/js/src/components/Event/DateTimePicker.vue new file mode 100644 index 000000000..3862876ad --- /dev/null +++ b/js/src/components/Event/DateTimePicker.vue @@ -0,0 +1,33 @@ + + diff --git a/js/src/views/Event/Create.vue b/js/src/views/Event/Create.vue index 4e3a8d08f..bdbb1b302 100644 --- a/js/src/views/Event/Create.vue +++ b/js/src/views/Event/Create.vue @@ -5,12 +5,13 @@
Loading...
-
+ - + - + +
@@ -51,9 +52,10 @@ import { IPerson, Person } from '@/types/actor'; import PictureUpload from '@/components/PictureUpload.vue'; import { IPictureUpload } from '@/types/picture.model'; import Editor from '@/components/Editor.vue'; +import DateTimePicker from '@/components/Event/DateTimePicker.vue'; @Component({ - components: { PictureUpload, Editor }, + components: { DateTimePicker, PictureUpload, Editor }, apollo: { loggedPerson: { query: LOGGED_PERSON, @@ -69,6 +71,14 @@ export default class CreateEvent extends Vue { pictureFile?: File; pictureName?: String; + created() { + const now = new Date(); + const end = new Date(); + end.setUTCHours(now.getUTCHours() + 3); + this.event.beginsOn = now; + this.event.endsOn = end; + } + createEvent(e: Event) { e.preventDefault(); this.event.organizerActor = this.loggedPerson;