Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 16539e5

Browse files
WardormeurArayB
authored andcommitted
Set up the different fields/information
1 parent 941df24 commit 16539e5

File tree

6 files changed

+204
-0
lines changed

6 files changed

+204
-0
lines changed

index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ exports.register = function (server, options, next) {
8080
}
8181
});
8282

83+
server.route({
84+
method: 'GET',
85+
path: '/dashboard/dojos/{dojoId}/events/new',
86+
handler :{
87+
file: {
88+
path: 'index.html'
89+
}
90+
}
91+
});
92+
8393
server.route({
8494
method: 'GET',
8595
path: '/dashboard/dojos/{dojoId}/join-requests/{id}/status/{status}',

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"cypress:install": "cypress install"
2121
},
2222
"dependencies": {
23+
"@ckeditor/ckeditor5-build-classic": "^12.1.0",
24+
"@ckeditor/ckeditor5-vue": "^1.0.0-beta.1",
2325
"@coderdojo/cd-common": "1.1.11",
2426
"bootstrap": "^3.4.1",
2527
"cp-translations": "1.0.133",

src/common/cd-dropdown.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<div :class="{ 'btn-group': true, 'open': open }">
3+
<slot name="submit"></slot>
34
<button type="button" :class="buttonClass" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @click="open = !open" @blur="onButtonBlur">
45
<i v-if="icon" :class="iconClass"></i>{{ text }} <span class="caret"></span>
56
</button>

src/events/cd-event-form.vue

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
<template>
2+
<div class="cd-event-form">
3+
<div class="cd-event-form__left-column">
4+
<h1 class="cd-event-form__header">{{ $t('Create an event') }}</h1>
5+
<form @submit="save">
6+
<input type="text" name="title" v-model="title" class="form-control" :placeholder="$t('e.g. October Dojo')">
7+
<div class="cd-event-form__location">
8+
<!-- is the text relevant when it's been modified? -->
9+
<!-- what about previous event information, default back to Dojo's or previous event ? -->
10+
{{ $t('This event uses the Dojo address.') }}
11+
<span v-show="!addressIsVisible">{{ formattedAddress }}</span>
12+
<i class="fa fa-pencil" @click="addressIsVisible = true" v-show="!addressIsVisible"></i>
13+
<i class="fa fa-times" @click="addressIsVisible = false" v-show="addressIsVisible"></i>
14+
<div v-if="addressIsVisible">
15+
<input type="text" name="city" v-model="city" class="form-control">
16+
<textarea name="address" v-model="address" rows="3" class="form-control"></textarea>
17+
</div>
18+
</div>
19+
<div class="cd-event-form__description">
20+
{{ $t('This event uses the previous event description') }}
21+
<span v-show="!descriptionIsVisible">{{ truncatedDescription }}</span>
22+
<i class="fa fa-pencil" @click="descriptionIsVisible = true" v-show="!descriptionIsVisible"></i>
23+
<i class="fa fa-times" @click="descriptionIsVisible = false" v-show="descriptionIsVisible"></i>
24+
<div v-if="descriptionIsVisible">
25+
<ckeditor :editor="editor" v-model="description"></ckeditor>
26+
</div>
27+
</div>
28+
<div class="cd-event-form__date form-group">
29+
<input list="days" type="number" name="day" v-model="day" class="form-control">
30+
<datalist id="days" v-model="day">
31+
<option v-for="day in 31" :key="index" :value="day">{{ day }} </option>
32+
</datalist>
33+
<select name="month" v-model="month">
34+
<option v-for="(month, index) in months" :value="index">{{ month }}</option>
35+
</select>
36+
<input list="years" type="number" name="year" v-model="year" class="form-control">
37+
<datalist id="years" v-model="year">
38+
<option v-for="year in 3" :key="index">{{ year + today.year() -1 }} </option>
39+
</datalist>
40+
</div>
41+
<div class="cd-event-form__date form-group">
42+
<input type="datetime-local" name="day" :value="today" :min="today">
43+
</div>
44+
<dropdown type="primary" display="splitted" class="cd-event-form__button">
45+
<button slot="submit" type="submit" class="btn btn-primary">
46+
{{ $t('Publish and email members') }}
47+
</button>
48+
<li><a href="#">Publish only</a></li>
49+
<li><a href="#">Save as draft</a></li>
50+
</dropdown>
51+
</form>
52+
</div>
53+
<div class="cd-event-form__right-column">
54+
<div class="cd-event-form__info-box">
55+
<h3 class="cd-event-form__info-box-header">Say "Hi" to our new events!</h3>
56+
<p>We simplified our events experience, read <a href="TODO">about it here</a>. To use the old more complicated interface, click <a href="TODO">Advanced Events</a></p>
57+
<p>If you need any help, <a href="mailto:[email protected]">email support</a>.</p>
58+
</div>
59+
</div>
60+
</div>
61+
</template>
62+
<script>
63+
import moment from 'moment';
64+
import DojoService from '@/dojos/service';
65+
import Dropdown from '@/common/cd-dropdown';
66+
import CKEditor from '@ckeditor/ckeditor5-vue';
67+
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
68+
import EventTile from './cd-event-tile';
69+
70+
export default {
71+
name: 'event-form',
72+
mixins: [EventTile],
73+
components: {
74+
ckeditor: CKEditor.component,
75+
dropdown: Dropdown,
76+
},
77+
data() {
78+
return {
79+
title: '',
80+
description: '',
81+
city: '',
82+
address: '',
83+
day: moment().date(),
84+
// TODO: momentjs get month of current locale
85+
month: moment().month(),
86+
year: new Date().getFullYear(),
87+
dojo: {},
88+
today: moment.utc(),
89+
//
90+
editor: ClassicEditor,
91+
// state
92+
addressIsVisible: false,
93+
descriptionIsVisible: false,
94+
};
95+
},
96+
methods: {
97+
save(e) {
98+
e.preventDefault();
99+
},
100+
toggle(field) { // eslint-disable-line no-unused-vars
101+
// eslint-disable-next-line no-param-reassign
102+
field = !field;
103+
},
104+
},
105+
computed: {
106+
eventDay() {
107+
return moment.utc(this.day, this.month, this.year);
108+
},
109+
truncatedDescription() {
110+
return this.description.substring(0, 20);
111+
},
112+
formattedAddress() {
113+
return `${this.address.substring(0, 15)}... ${this.city}`;
114+
},
115+
months() {
116+
return moment.localeData().monthsShort();
117+
},
118+
},
119+
async created() {
120+
const { dojoId } = this.$route.params;
121+
this.dojo = (await DojoService.getDojoById(dojoId)).body;
122+
this.address = this.dojo.address1;
123+
this.city = this.dojo.city.name;
124+
},
125+
};
126+
</script>
127+
<style scoped lang="less">
128+
@import "../common/variables";
129+
130+
.cd-event-form {
131+
display: flex;
132+
flex-direction: row;
133+
padding-bottom: 5em;
134+
&__left-column {
135+
flex: 2;
136+
display: flex;
137+
flex-direction: column;
138+
padding: @margin;
139+
}
140+
&__right-column {
141+
flex: 1;
142+
display: flex;
143+
flex-direction: column;
144+
justify-content: space-around;
145+
}
146+
&__info-box {
147+
background-color: @side-column-grey;
148+
padding: @margin;
149+
&-header {
150+
margin-top: 10px;
151+
}
152+
}
153+
&__header {
154+
.title;
155+
}
156+
&__location, &__description {
157+
margin-top: @margin;
158+
}
159+
&__description {
160+
margin-bottom: @margin;
161+
}
162+
&__date {
163+
flex: 1;
164+
display: flex;
165+
flex-direction: row;
166+
// TODO: Proper styling per field, not lazy
167+
max-width: 50%;
168+
}
169+
&__button {
170+
float: right;
171+
}
172+
}
173+
</style>

src/router/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import UserTickets from '@/users/cd-tickets';
77
import EventDetails from '@/events/order/cd-event-details';
88
import LoginOrRegister from '@/users/cd-login-or-register';
99
import EventSessions from '@/events/order/cd-event-sessions';
10+
import EventForm from '@/events/cd-event-form';
1011
import BookingConfirmation from '@/events/order/cd-booking-confirmation';
1112
import Login from '@/users/cd-login';
1213
import orderWrapper from '@/events/order/wrapper';
@@ -84,6 +85,13 @@ const router = new Router({
8485
component: UserTickets,
8586
beforeEnter: loggedInNavGuard,
8687
},
88+
{
89+
path: '/dashboard/dojos/:dojoId/events/new',
90+
name: 'EventForm',
91+
component: EventForm,
92+
// TODO: restrict access to ticketing-admin ?
93+
beforeEnter: loggedInNavGuard,
94+
},
8795
{
8896
path: '/dashboard/dojos/:dojoId/join-requests/:requestId/status/:status',
8997
name: 'ManageRequestToJoin',

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
# yarn lockfile v1
33

44

5+
"@ckeditor/ckeditor5-build-classic@^12.1.0":
6+
version "12.1.0"
7+
resolved "https://registry.yarnpkg.com/@ckeditor/ckeditor5-build-classic/-/ckeditor5-build-classic-12.1.0.tgz#bd8127b8f11ce0a33a3dd8893546bbed5ab5fd30"
8+
integrity sha512-SYT+stYBS8JqxWZNye5x9AlwNmwY7+bp2IKNdZDsolKFF1CjOC18gmIB4isGfINzFgn/ke1H21XDenZYp3IxqA==
9+
10+
"@ckeditor/ckeditor5-vue@^1.0.0-beta.1":
11+
version "1.0.0-beta.1"
12+
resolved "https://registry.yarnpkg.com/@ckeditor/ckeditor5-vue/-/ckeditor5-vue-1.0.0-beta.1.tgz#976bf7b00bd5f9d99637bfa8279e35f2e899c334"
13+
integrity sha512-CTNyEdofAfmhVomkft6kYEmbh6yRvZMzkvCC4bHZ8LOBHBY7QWkWXP3gbs19SvimUV7PfnsrsDE093aI0SyXqQ==
14+
515
"@coderdojo/[email protected]":
616
version "1.1.11"
717
resolved "https://registry.yarnpkg.com/@coderdojo/cd-common/-/cd-common-1.1.11.tgz#fb42fa68eff8b47d9843007db013d3f3fb4b1f95"

0 commit comments

Comments
 (0)