1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
|
{{#if eventHasCoverImage}}
<div id="eventImageContainer" style="background-image: url(/events/{{eventData.image}});"></div>
{{else}}
<div id="genericEventImageContainer" style="background-image: url(/images/seigaiha.png);"></div>
{{/if}}
<div class="row">
<div class="col-lg">
<h3 id="eventName">{{eventData.name}}</h3>
</div>
{{#if editingEnabled}}
<div class="col-lg-2 ml-2 edit-buttons">
<div class="btn-group" role="group" aria-label="Event controls">
<button type="button" id="editEvent" class="btn btn-success" data-toggle="modal" data-target="#editModal" {{#if eventHasConcluded}}disabled{{/if}}><i class="fas fa-edit"></i></button>
<button type="button" id="deleteEvent" class="btn btn-danger" data-toggle="modal" data-target="#deleteModal"><i class="fas fa-trash"></i></button>
</div>
</div>
{{/if}}
</div>
<div class="card mt-4 mb-4">
<div class="card-body">
<ul class="fa-ul eventInformation">
<li>
<span class="fa-li">
<i class="fas fa-map-marker-alt"></i>
</span>
{{eventData.location}}<br />
<a target="_blank" href="http://maps.google.com/?q={{parsedLocation}}" class="eventInformationAction btn btn-outline-secondary btn-sm">
<i class="fas fa-map-marked"></i> Show on Google Maps
</a>
<a target="_blank" href="https://www.openstreetmap.org/search?query={{parsedLocation}}" class="eventInformationAction btn btn-outline-secondary btn-sm">
<i class="fas fa-map-marked"></i> Show on OpenStreetMap
</a>
</li>
<li>
<span class="fa-li">
<i class="fas fa-fw fa-calendar-day"></i>
</span>
{{{displayDate}}}
<br>
<span class="text-muted">
{{#if eventHasBegun}}{{#unless eventHasConcluded}}Started {{else}}Ended {{/unless}}{{/if}}{{fromNow}}
</span>
<br />
<a href="http://www.google.com/calendar/event?action=TEMPLATE&dates={{parsedStart}}%2F{{parsedEnd}}&text={{escapedName}}&location={{parsedLocation}}&ctz={{timezone}}" class="eventInformationAction btn btn-outline-secondary btn-sm">
<i class="far fa-calendar-plus"></i> Add to Google Calendar
</a>
</li>
{{#if eventHasHost}}
<li>
<span class="fa-li">
<i class="fas fa-fw fa-user-circle"></i>
</span>
<span class="text-muted">Hosted by</span> {{eventData.hostName}}
</li>
{{/if}}
{{#if eventData.eventGroup}}
<li>
<span class="fa-li">
<i class="fas fa-fw fa-calendar-alt"></i>
</span>
<span class="text-muted">Part of</span> <a href="/group/{{eventData.eventGroup.id}}">{{eventData.eventGroup.name}}</a>
</li>
{{/if}}
{{#if eventData.url}}
<li>
<span class="fa-li">
<i class="fas fa-fw fa-link"></i>
</span>
<a href="{{eventData.url}}">
{{eventData.url}}
</a>
</li>
{{/if}}
<li>
<span class="fa-li">
<i class="fas fa-fw fa-share-square"></i>
</span>
<a href="https://{{domain}}/{{eventData.id}}">{{domain}}/{{eventData.id}}</a>
<button type="button" id="copyEventLink" class="eventInformationAction btn btn-outline-secondary btn-sm" data-clipboard-text="https://{{domain}}/{{eventData.id}}">
<i class="fas fa-copy"></i> Copy
</button>
</li>
<li>
<span class="fa-li">
<i class="fas fa-fw fa-share-square"></i>
</span>
@{{eventData.id}}@{{domain}}
<button type="button" id="copyAPLink" class="eventInformationAction btn btn-outline-secondary btn-sm" data-clipboard-text="@{{eventData.id}}@{{domain}}">
<i class="fas fa-copy"></i> Copy
</button>
</li>
</ul>
</div>
</div>
{{#if eventHasConcluded}}
<div class="alert alert-warning mb-4" role="alert">
This event has concluded. It can no longer be edited, and will be automatically deleted <span class="daysToDeletion"></span>.
</div>
{{/if}}
{{#if firstLoad}}
<div class="alert alert-success alert-dismissible fade show" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
Welcome to your event! We've just sent you an email with your secret editing link, which you can also see in the address bar above. Haven't got the email? Check your spam or junk folder. To share your event, use the link you can see just above this message - that way your attendees won't be able to edit or delete your event!
</div>
{{/if}}
<div class="card mb-4" id="eventDescription">
<h5 class="card-header">About</h5>
<div class="card-body">
{{{parsedDescription}}}
</div>
</div>
{{#if eventData.usersCanAttend}}
<div class="card mb-4" id="eventAttendees">
<h5 class="card-header">Attendees {{#if eventAttendees}}({{eventAttendees.length}}){{/if}}
<div class="btn-group" role="group" aria-label="Attendance controls">
{{#unless noMoreSpots}}
<button type="button" id="attendEvent" class="btn btn-success" data-toggle="modal" data-target="#attendModal"><i class="fas fa-user-plus"></i> Add me</button>
{{/unless}}
<button type="button" id="unattendEvent" class="btn btn-secondary" data-toggle="modal" data-target="#unattendModal"><i class="fas fa-user-times"></i> Remove me</button>
</div>
</h5>
<div class="card-body">
{{#if eventData.maxAttendees}}
{{#if noMoreSpots}}
<div class="alert alert-warning text-center">This event is at capacity.</div>
{{else}}
<div class="alert alert-warning text-center">{{spotsRemaining}} {{plural spotsRemaining "spot(s)"}} remaining - add yourself now!</div>
{{/if}}
{{/if}}
{{#if eventAttendees}}
<ul class="attendeesList">
{{#each eventAttendees}}
<li{{#if ../editingEnabled}} data-attendee-name="{{this.name}}" data-attendee-id="{{this._id}}"{{/if}}>{{#if this.email}}<span class="attendee-name">{{this.name}}</span>{{else}}<a href="{{this.id}}"><span class="attendee-name">{{this.name}}</span></a>{{/if}}{{#if ../editingEnabled}} <a href="#" class="remove-attendee" data-toggle="modal" data-target="#removeAttendeeModal" title="Remove user from event"><i class="fas fa-user-times"></i></a>{{/if}}</li>
{{/each}}
</ul>
{{else}}
<p class="text-center text-muted mb-0">No attendees yet!</p>
{{/if}}
</div>
</div>
<div class="modal fade" id="attendModal" tabindex="-1" role="dialog" aria-labelledby="attendModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="attendModalLabel">Add yourself to '{{eventData.name}}'</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form id="attendEventForm" action="/attendevent/{{eventData.id}}" method="post">
<div class="modal-body">
<div class="form-group row">
<label for="attendeeName" class="col-sm-2 col-form-label">Your name</label>
<div class="form-group col-sm-10">
<input type="text" class="form-control" id="attendeeName" name="attendeeName" placeholder="Or an alias, perhaps..." data-validation="required length" data-validation-length="3-30">
</div>
</div>
<div class="form-group row">
<label for="attendeeEmail" class="col-sm-2 col-form-label">Your email</label>
<div class="form-group col-sm-10">
<input type="email" class="form-control" id="attendeeEmail" name="attendeeEmail" placeholder="We won't spam you <3" data-validation="email">
<small class="form-text">We'll only use it to send you updates to the event.</small>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Add myself</button>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="unattendModal" tabindex="-1" role="dialog" aria-labelledby="unattendModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="unattendModalLabel">Remove yourself from '{{eventData.name}}'</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form id="unattendEventForm" action="/unattendevent/{{eventData.id}}" method="post">
<div class="modal-body">
<div class="form-group row">
<label for="attendeeEmail" class="col-sm-2 col-form-label">Your email</label>
<div class="form-group col-sm-10">
<input type="email" class="form-control" id="attendeeEmail" name="attendeeEmail" placeholder="name@domain.com" data-validation="email" data-validation-optional="true">
<small class="form-text">Enter the email you used when signing up for this event.</small>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Remove myself</button>
</div>
</form>
</div>
</div>
</div>
{{#if editingEnabled}}
<div class="modal fade" id="removeAttendeeModal" tabindex="-1" role="dialog" aria-labelledby="removeAttendeeModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="removeAttendeeModalLabel">Remove attendee from '{{eventData.name}}'</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form id="removeAttendeeForm" action="/removeattendee/{{eventData.id}}/" method="post">
<div class="modal-body">
<p>Are you sure you want to remove this attendee from the event? This action cannot be undone.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-danger">Remove attendee</button>
</div>
</form>
</div>
</div>
</div>
{{/if}}
{{/if}}
{{#if eventData.usersCanComment}}
<div class="card mb-4" id="eventComments">
<h5 class="card-header">Discussion</h5>
<div class="card-body">
<form id="commentForm" action="/post/comment/{{eventData.id}}/" method="post">
<div class="form-group">
<input type="text" class="form-control" id="commentAuthor" name="commentAuthor" placeholder="Your name" data-validation="required length" data-validation-length="3-60">
</div>
<div class="form-group">
<div class="input-group">
<textarea class="form-control" id="commentContent" name="commentContent" style="resize: none;" placeholder="What would you like to ask?" data-validation="required length" data-validation-length="3-280"></textarea>
<div class="input-group-append">
<button type="submit" class="btn btn-primary btn-block h-100" id="postComment">Send <i class="fas fa-chevron-right"></i></button>
</div>
</div>
</div>
</form>
{{#if eventData.comments}}
<hr style="border-style:dashed;">
<div class="container commentsList">
{{#each eventData.comments}}
<div class="comment">
<div class="row commentContainer">
<div class="col-lg commentText">
{{#if this.actorId}}
<p class="mb-0"><a href="{{this.actorId}}"><strong>{{this.author}}</strong></a> <a href="{{this.activityId}}"><small class="commentTimestamp text-muted">{{this.timestamp}}</small></a></p>
{{else}}
<p class="mb-0"><strong>{{this.author}}</strong> <small class="commentTimestamp text-muted">{{this.timestamp}}</small></p>
{{/if}}
<p>{{this.content}}</p>
{{#if this.replies}}
<hr>
<div class="repliesContainer">
{{#each this.replies}}
<p class="mb-0"><strong><i class="fas fa-reply text-muted"></i> {{this.author}}</strong> <small class="commentTimestamp text-muted">{{this.timestamp}}</small></p>
<p>{{this.content}}</p>
{{/each}}
</div>
{{/if}}
</div>
<div class="col-lg-3 commentMetadata text-right">
<button type="button" class="btn btn-outline-primary btn-sm openReplyBox">
<i class="fas fa-comment"></i> Reply
</button>
{{#if ../editingEnabled}}
<form class="d-inline" action="/deletecomment/{{../eventData.id}}/{{this._id}}/{{../eventData.editToken}}" method="post">
<button type="submit" class="btn btn-outline-danger btn-sm deleteComment">
<i class="fas fa-trash"></i> Delete
</button>
</form>
{{/if}}
</div>
</div>
<div class="row replyContainer">
<div class="col-md">
<form id="replyForm" action="/post/reply/{{../eventData.id}}/{{this._id}}" method="post">
<div class="form-group">
<input type="text" class="form-control form-control-sm" id="replyAuthor" name="replyAuthor" placeholder="Your name" data-validation="required length" data-validation-length="3-60">
</div>
<div class="form-group">
<div class="input-group">
<textarea class="form-control form-control-sm" id="replyContent" name="replyContent" style="resize: none;" placeholder="What would you like to reply?" data-validation="required length" data-validation-length="3-280"></textarea>
<div class="input-group-append">
<button type="submit" class="btn btn-primary btn-block h-100 btn-sm" id="postReply">Reply <i class="fas fa-chevron-right"></i></button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
{{/each}}
</div>
{{/if}}
</div>
</div>
{{/if}}
{{#if editingEnabled}}
{{#unless eventHasConcluded}}
{{> editeventmodal }}
{{/unless}}
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteModalLabel">Delete '{{eventData.name}}'</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form id="editEventForm" action="/deleteevent/{{eventData.id}}/{{eventData.editToken}}" method="post">
<div class="modal-body">
<p>Are you sure you want to delete this event? This action cannot be undone.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-danger">Delete event</button>
</div>
</form>
</div>
</div>
</div>
{{/if}}
{{#unless eventHasConcluded}}
<script type="text/javascript" src="/js/generate-timezones.js"></script>
{{/unless}}
<script>
$.validate({
lang: 'en',
errorElementClass: "is-invalid",
errorMessageClass: "text-danger",
successElementClass: "is-valid"
});
{{#if editingEnabled}}
$('#removeAttendeeModal').on('show.bs.modal', function (event) {
var listItem = $(event.relatedTarget).closest('li'); // List element enclosing button
var attendeeName = listItem.data('attendee-name');
var attendeeID = listItem.data('attendee-id');
var modal = $(this);
modal.find('.modal-title').text('Remove ' + attendeeName + ' from {{eventData.name}}')
modal.find('#removeAttendeeForm').attr('action', '/removeattendee/{{eventData.id}}/' + attendeeID);
})
{{#unless eventHasConcluded}}
$('#eventStart').datepicker({
language: 'en',
timepicker: true,
dateFormat: 'd MM yyyy',
dateTimeSeparator: ', ',
onSelect: function(formattedDate, rawDate){
$('#eventEnd').datepicker().data('datepicker').update('minDate', rawDate).clear();
}
});
$('#eventEnd').datepicker({
language: 'en',
timepicker: true,
dateFormat: 'd MM yyyy',
dateTimeSeparator: ', '
});
$("#timezone").val('{{eventData.timezone}}').trigger('change');
console.log('{{eventData.timezone}}')
{{/unless}}
{{/if}}
$(".commentTimestamp").html(function(){
parsedDate = moment($(this).html()).fromNow();
return parsedDate;
});
$(".openReplyBox").click(function(){
// let replyID = $(this).attr("data-id");
$(this).closest(".comment").find(".replyContainer").slideToggle();
})
$(document).ready(function() {
$.uploadPreview({
input_field: "#image-upload",
preview_box: "#image-preview",
label_field: "#image-label",
label_default: "Choose file",
label_selected: "Change file",
no_label: false
});
$("#image-preview").css("background-image", "url('/events/{{eventData.image}}')");
$("#image-preview").css("background-size", "cover");
$("#image-preview").css("background-position", "center center");
{{#if editingEnabled}}
{{#unless eventHasConcluded}}
$('#eventStart').datepicker().data('datepicker').selectDate(moment('{{parsedStart}}', 'YYYYMMDD[T]HHmmss').toDate());
$('#eventEnd').datepicker().data('datepicker').selectDate(moment('{{parsedEnd}}', 'YYYYMMDD[T]HHmmss').toDate());
{{/unless}}
{{/if}}
new ClipboardJS('#copyEventLink');
autosize($('textarea'));
$("#copyEventLink").click(function(){
$(this).html('<i class="fas fa-copy"></i> Copied!');
setTimeout(function(){ $("#copyEventLink").html('<i class="fas fa-copy"></i> Copy');}, 5000);
})
new ClipboardJS('#copyAPLink');
$("#copyAPLink").click(function(){
console.log('hhhhh')
$(this).html('<i class="fas fa-copy"></i> Copied!');
setTimeout(function(){ $("#copyAPLink").html('<i class="fas fa-copy"></i> Copy');}, 5000);
})
$(".daysToDeletion").html(moment("{{eventEndISO}}").add(7, 'days').fromNow());
if ($("#joinCheckbox").is(':checked')){
$("#maxAttendeesCheckboxContainer").css("display","flex");
}
$("#maxAttendeesCheckbox").on("click", function() {
if ($(this).is(':checked')) {
$("#maxAttendeesContainer").slideDown('fast').css("display","flex");
$("#maxAttendees").attr("data-validation-optional","false");
}
else {
$("#maxAttendeesContainer").slideUp('fast');
$("#maxAttendees").attr("data-validation-optional","true").val("").removeClass('is-valid is-invalid');
}
});
$("#joinCheckbox").on("click", function() {
if ($(this).is(':checked')) {
$("#maxAttendeesCheckboxContainer").slideDown('fast').css("display","flex");
}
else {
$("#maxAttendeesCheckboxContainer").slideUp('fast');
$("#maxAttendeesCheckbox").prop("checked",false);
$("#maxAttendeesContainer").slideUp('fast');
$("#maxAttendees").attr("data-validation-optional","true").val("").removeClass('is-valid is-invalid');
}
});
$("#eventGroupCheckbox").on("click", function() {
if ($(this).is(':checked')) {
$("#eventGroupData").slideDown('fast');
$("#eventGroupID").removeAttr("data-validation-optional").attr("data-validation","required");
$("#eventGroupEditToken").removeAttr("data-validation-optional").attr("data-validation","required");
}
else {
$("#eventGroupData").slideUp('fast');
$("#eventGroupID").removeAttr("data-validation").attr("data-validation-optional","true").val("");
$("#eventGroupEditToken").removeAttr("data-validation").attr("data-validation-optional","true").val("");
}
});
});
</script>
|