-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrsvp2.ur
604 lines (554 loc) · 33.7 KB
/
rsvp2.ur
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
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
open Bootstrap3
functor Make(M : sig
val homeLabel : string
con homeKey1 :: Name
type homeKeyT
con homeKeyR :: {Type}
constraint [homeKey1] ~ homeKeyR
con homeKey = [homeKey1 = homeKeyT] ++ homeKeyR
con homeData :: {Type}
con homeSensitiveData :: {Type}
con homeRest :: {Type}
constraint homeKey ~ homeRest
constraint (homeKey ++ homeRest) ~ homeData
constraint (homeKey ++ homeRest ++ homeData) ~ homeSensitiveData
con homeKeyName :: Name
con homeOtherConstraints :: {{Unit}}
constraint [homeKeyName] ~ homeOtherConstraints
val home : sql_table (homeKey ++ homeData ++ homeSensitiveData ++ homeRest) ([homeKeyName = map (fn _ => ()) homeKey] ++ homeOtherConstraints)
val homeInj : $(map sql_injectable_prim homeKey)
val homeKeyFl : folder homeKey
val homeKeyShow : show $homeKey
val homeKeyEq : $(map eq homeKey)
val homeDataFl : folder homeData
val homeDataShow : $(map show homeData)
val homeDataLabels : $(map (fn _ => string) homeData)
val homeSensitiveDataFl : folder homeSensitiveData
val homeSensitiveDataShow : $(map show homeSensitiveData)
val homeSensitiveDataLabels : $(map (fn _ => string) homeSensitiveData)
val awayLabel : string
con awayKey1 :: Name
type awayKeyT
con awayKeyR :: {Type}
constraint [awayKey1] ~ awayKeyR
con awayKey = [awayKey1 = awayKeyT] ++ awayKeyR
con awayData :: {Type}
con awaySensitiveData :: {Type}
con awayRest :: {Type}
constraint awayKey ~ awayRest
constraint (awayKey ++ awayRest) ~ awayData
constraint (awayKey ++ awayRest ++ awayData) ~ awaySensitiveData
con awayKeyName :: Name
con awayOtherConstraints :: {{Unit}}
constraint [awayKeyName] ~ awayOtherConstraints
val away : sql_table (awayKey ++ awayData ++ awaySensitiveData ++ awayRest) ([awayKeyName = map (fn _ => ()) awayKey] ++ awayOtherConstraints)
val awayInj : $(map sql_injectable_prim awayKey)
val awayKeyFl : folder awayKey
val awayKeyShow : show $awayKey
val awayKeyEq : $(map eq awayKey)
val awayDataFl : folder awayData
val awayDataShow : $(map show awayData)
val awayDataLabels : $(map (fn _ => string) awayData)
val awaySensitiveDataFl : folder awaySensitiveData
val awaySensitiveDataShow : $(map show awaySensitiveData)
val awaySensitiveDataLabels : $(map (fn _ => string) awaySensitiveData)
con eventKey1 :: Name
type eventKeyT
con eventKeyR :: {Type}
constraint [eventKey1] ~ eventKeyR
con eventKey = [eventKey1 = eventKeyT] ++ eventKeyR
con eventData :: {Type} (* Per-guest information to display *)
con eventRest :: {Type}
constraint eventKey ~ eventRest
constraint (eventKey ++ eventRest) ~ eventData
con eventKeyName :: Name
con eventOtherConstraints :: {{Unit}}
constraint [eventKeyName] ~ eventOtherConstraints
val event : sql_table (eventKey ++ eventData ++ eventRest) ([eventKeyName = map (fn _ => ()) eventKey] ++ eventOtherConstraints)
val render : $eventData -> xbody
val eventInj : $(map sql_injectable_prim eventKey)
val eventKeyFl : folder eventKey
val eventKeyShow : show $eventKey
val eventKeyEq : $(map eq eventKey)
constraint homeKey ~ eventKey
constraint awayKey ~ eventKey
val amHome : transaction (option $homeKey)
val amPrivilegedHome : transaction (option $homeKey)
val amAway : transaction (option $awayKey)
end) = struct
open M
val homeKeyEq : eq $homeKey = @@Record.eq [homeKey] homeKeyEq homeKeyFl
val awayKeyEq : eq $awayKey = @@Record.eq [awayKey] awayKeyEq awayKeyFl
val eventKeyEq : eq $eventKey = @@Record.eq [eventKey] eventKeyEq eventKeyFl
table homeRsvp : (homeKey ++ eventKey)
PRIMARY KEY {{@primary_key [homeKey1] [homeKeyR ++ eventKey] ! !
(homeInj ++ eventInj)}},
{{one_constraint [#Home] (@Sql.easy_foreign ! ! ! ! ! ! homeKeyFl home)}},
{{one_constraint [#Event] (@Sql.easy_foreign ! ! ! ! ! ! eventKeyFl event)}}
table awayRsvp : (awayKey ++ eventKey)
PRIMARY KEY {{@primary_key [awayKey1] [awayKeyR ++ eventKey] ! !
(awayInj ++ eventInj)}},
{{one_constraint [#Away] (@Sql.easy_foreign ! ! ! ! ! ! awayKeyFl away)}},
{{one_constraint [#Event] (@Sql.easy_foreign ! ! ! ! ! ! eventKeyFl event)}}
datatype user h a = Home of ($homeKey * option h) | Away of ($awayKey * option a)
datatype operation = Add | Del
type log h a = {Event : $eventKey, User : user h a, Operation : operation}
table listeners : {Channel : channel (log $homeData $awayData)}
table privilegedListeners : {Channel : channel (log $(homeData ++ homeSensitiveData) $(awayData ++ awaySensitiveData))}
val homeInj' = @mp [sql_injectable_prim] [sql_injectable] @@sql_prim homeKeyFl homeInj
val awayInj' = @mp [sql_injectable_prim] [sql_injectable] @@sql_prim awayKeyFl awayInj
val eventInj' = @mp [sql_injectable_prim] [sql_injectable] @@sql_prim eventKeyFl eventInj
functor HomeFn(N : sig
con homeShownData :: {Type}
val homeShownData : $(homeData ++ homeSensitiveData) -> $homeShownData
val homeShownDataFl : folder homeShownData
val homeShownDataShow : $(map show homeShownData)
val homeShownDataLabels : $(map (fn _ => string) homeShownData)
con awayShownData :: {Type}
val awayShownData : $(awayData ++ awaySensitiveData) -> $awayShownData
val awayShownDataFl : folder awayShownData
val awayShownDataShow : $(map show awayShownData)
val awayShownDataLabels : $(map (fn _ => string) awayShownData)
table my_listeners : {Channel : channel (log $homeShownData $awayShownData)}
val amHome : transaction (option $homeKey)
end) = struct
open N
type home = {Home : $homeKey, Data : $homeShownData}
type homeEnts = list home
type away = {Away : $awayKey, Data : $awayShownData}
type awayEnts = list away
type event = {Event : $eventKey, Data : $eventData, Home : homeEnts, Away : awayEnts}
type events = list event
type input = _
type a = _
fun ensure ho =
user <- amHome;
case user of
None => error <xml>Must be authenticated to access this page</xml>
| Some user =>
if user = ho then
return ()
else
error <xml>Wrong user to be accessing this page</xml>
fun add ev ho =
ensure ho;
da <- oneRow1 (SELECT home.{{homeData}}, home.{{homeSensitiveData}}
FROM home
WHERE {@@Sql.easy_where [#Home] [homeKey] [_] [_] [_] [_]
! ! homeInj' homeKeyFl ho});
@@Sql.easy_insert [eventKey ++ homeKey] [_] (eventInj' ++ homeInj')
(@Folder.concat ! eventKeyFl homeKeyFl) homeRsvp (ev ++ ho);
queryI1 (SELECT * FROM listeners)
(fn r => send r.Channel {Event = ev,
User = Home (ho, Some (da --- homeSensitiveData)),
Operation = Add});
queryI1 (SELECT * FROM privilegedListeners)
(fn r => send r.Channel {Event = ev,
User = Home (ho, Some da),
Operation = Add})
fun del ev ho =
ensure ho;
dml (DELETE FROM homeRsvp
WHERE {@@Sql.easy_where [#T] [eventKey ++ homeKey] [_] [_] [_] [_]
! ! (eventInj' ++ homeInj') (@Folder.concat ! eventKeyFl homeKeyFl) (ev ++ ho)});
queryI1 (SELECT * FROM listeners)
(fn r => send r.Channel {Event = ev,
User = Home (ho, None),
Operation = Del});
queryI1 (SELECT * FROM privilegedListeners)
(fn r => send r.Channel {Event = ev,
User = Home (ho, None),
Operation = Del})
fun create ho =
let
fun initEvents (acc : events)
(evrows : list $(eventKey ++ eventData))
(homerows : list {HomeRsvp : $(homeKey ++ eventKey), Home : $homeShownData})
(awayrows : list {AwayRsvp : $(awayKey ++ eventKey), Away : $awayShownData})
(homes : homeEnts)
(aways : awayEnts)
: events =
case evrows of
[] =>
(* Processed all events. Done! *)
List.rev acc
| ev :: evrows' =>
let
(* Check to see if the first home row is for this event. *)
val opt =
case homerows of
[] => None
| r :: homerows' =>
if @eq eventKeyEq (r.HomeRsvp --- homeKey) (ev --- eventData) then
Some ({Home = r.HomeRsvp --- eventKey, Data = r.Home}, homerows')
else
None
in
case opt of
Some (ent, homerows') =>
initEvents acc
evrows
homerows'
awayrows
(ent :: homes)
aways
| None =>
let
(* Check to see if the first away row is for this event. *)
val opt =
case awayrows of
[] => None
| r :: awayrows' =>
if @eq eventKeyEq (r.AwayRsvp --- awayKey) (ev --- eventData) then
Some ({Away = r.AwayRsvp --- eventKey, Data = r.Away}, awayrows')
else
None
in
case opt of
Some (ent, awayrows') =>
initEvents acc
evrows
homerows
awayrows'
homes
(ent :: aways)
| None =>
(* No matching attendees remain. Add this event record. *)
initEvents ({Event = ev --- eventData,
Data = ev --- eventKey,
Home = List.rev homes,
Away = List.rev aways} :: acc)
evrows'
homerows
awayrows
[]
[]
end
end
in
events <- queryL1 (SELECT event.{{eventKey}}, event.{{eventData}}
FROM event
ORDER BY {{{@Sql.order_by eventKeyFl
(@Sql.some_fields [#Event] [eventKey] ! ! eventKeyFl)
sql_desc}}});
homes <- queryL (SELECT homeRsvp.*, home.{{homeData}}, home.{{homeSensitiveData}}
FROM homeRsvp
JOIN home ON {@@Sql.easy_join [#HomeRsvp] [#Home] [homeKey]
[eventKey] [homeData ++ homeSensitiveData ++ homeRest] [_] [_] [_]
! ! ! ! homeKeyFl}
ORDER BY {{{@Sql.order_by (@Folder.concat ! eventKeyFl homeKeyFl)
(@Sql.some_fields [#HomeRsvp] [eventKey ++ homeKey] ! !
(@Folder.concat ! eventKeyFl homeKeyFl))
sql_desc}}});
aways <- queryL (SELECT awayRsvp.*, away.{{awayData}}, away.{{awaySensitiveData}}
FROM awayRsvp
JOIN away ON {@@Sql.easy_join [#AwayRsvp] [#Away] [awayKey]
[eventKey] [awayData ++ awaySensitiveData ++ awayRest] [_] [_] [_]
! ! ! ! awayKeyFl}
ORDER BY {{{@Sql.order_by (@Folder.concat ! eventKeyFl awayKeyFl)
(@Sql.some_fields [#AwayRsvp] [eventKey ++ awayKey] ! !
(@Folder.concat ! eventKeyFl awayKeyFl))
sql_desc}}});
events <- List.mapM (fn r =>
homes <- source r.Home;
aways <- source r.Away;
return (r -- #Home -- #Away ++ {Home = homes, Away = aways}))
(initEvents [] events
(List.mp (fn r => r -- #Home ++ {Home = homeShownData r.Home}) homes)
(List.mp (fn r => r -- #Away ++ {Away = awayShownData r.Away}) aways)
[] []);
chan <- channel;
dml (INSERT INTO my_listeners (Channel) VALUES ({[chan]}));
return {Self = ho, Events = events, Channel = chan}
end
fun render t =
List.mapX (fn ev => <xml>
<active code={expanded <- source False;
return <xml><div>
<h2>
<button dynClass={exp <- signal expanded;
return (if exp then
CLASS "btn btn-xs glyphicon glyphicon-chevron-up"
else
CLASS "btn btn-xs glyphicon glyphicon-chevron-down")}
onclick={fn _ =>
exp <- get expanded;
set expanded (not exp)}/>
{[@show eventKeyShow ev.Event]}
</h2>
<dyn signal={exp <- signal expanded;
if not exp then
return <xml/>
else
hos <- signal ev.Home;
aws <- signal ev.Away;
count <- return (List.length hos + List.length aws);
return <xml>
<div>{M.render ev.Data}</div>
<div>({[count]} attendee{[if count = 1 then "" else "s"]})</div>
{if List.exists (fn ho => ho.Home = t.Self) hos then
<xml>
<span class="glyphicon glyphicon-ok"/>
<span>Attending</span>
<button class="btn btn-primary"
value="Un-RSVP"
onclick={fn _ =>
rpc (del ev.Event t.Self)}/>
</xml>
else
<xml>
<span>Not attending</span>
<button class="btn btn-primary"
value="RSVP"
onclick={fn _ =>
rpc (add ev.Event t.Self)}/>
</xml>}
{case aws of
[] => <xml/>
| _ => <xml>
<h3>{[awayLabel]} ({[List.length aws]})</h3>
<table class="bs3-table table-striped">
<tr>
<th/>
{@mapX [fn _ => string] [tr]
(fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] label =>
<xml><th>{[label]}</th></xml>)
awayShownDataFl awayShownDataLabels}
</tr>
{List.mapX (fn aw => <xml><tr>
<td>{[aw.Away]}</td>
{@mapX2 [show] [ident] [tr]
(fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] (_ : show t) (x : t) =>
<xml><td>{[x]}</td></xml>)
awayShownDataFl awayShownDataShow aw.Data}
</tr></xml>) aws}
</table>
</xml>}
{case hos of
[] => <xml/>
| _ => <xml>
<h3>{[homeLabel]} ({[List.length hos]})</h3>
<table class="bs3-table table-striped">
<tr>
<th/>
{@mapX [fn _ => string] [tr]
(fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] label =>
<xml><th>{[label]}</th></xml>)
homeShownDataFl homeShownDataLabels}
</tr>
{List.mapX (fn ho => <xml><tr>
<td>{[ho.Home]}</td>
{@mapX2 [show] [ident] [tr]
(fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] (_ : show t) (x : t) =>
<xml><td>{[x]}</td></xml>)
homeShownDataFl homeShownDataShow ho.Data}
</tr></xml>) hos}
</table>
</xml>}
</xml>}/>
</div></xml>}/>
</xml>) t.Events
fun tweakEvent (f : {Home : homeEnts, Away : awayEnts} -> {Home : homeEnts, Away : awayEnts})
(ev : $eventKey) =
let
fun tweakEvents evs =
case evs of
[] => error <xml>Rsvp2.tweakEvent: unknown event</xml>
| ev' :: evs' =>
if ev'.Event = ev then
hos <- get ev'.Home;
aws <- get ev'.Away;
r <- return (f {Home = hos, Away = aws});
set ev'.Home r.Home;
set ev'.Away r.Away
else
tweakEvents evs'
in
tweakEvents
end
fun onload t =
let
fun loop () =
r <- recv t.Channel;
(case r.Operation of
Add =>
(case r.User of
Home (ho, da) =>
(case da of
None => error <xml>Rsvp2: no data for new home entry</xml>
| Some da =>
tweakEvent (fn r => r -- #Home
++ {Home =
List.sort (fn x y => show x.Home > show y.Home)
({Home = ho, Data = da} :: r.Home)})
r.Event t.Events)
| Away (aw, da) =>
(case da of
None => error <xml>Rsvp2: no data for new away entry</xml>
| Some da =>
tweakEvent (fn r => r -- #Away
++ {Away =
List.sort (fn x y => show x.Away > show y.Away)
({Away = aw, Data = da} :: r.Away)})
r.Event t.Events))
| Del =>
(case r.User of
Home (ho, _) =>
tweakEvent (fn r => r -- #Home
++ {Home = List.filter (fn x => x.Home <> ho) r.Home})
r.Event t.Events
| Away (aw, _) =>
tweakEvent (fn r => r -- #Away
++ {Away = List.filter (fn x => x.Away <> aw) r.Away})
r.Event t.Events));
loop ()
in
spawn (loop ())
end
fun ui x = {
Create = create x,
Onload = onload,
Render = fn _ => render
}
end
structure Home = HomeFn(struct
con homeShownData = homeData
fun homeShownData r = r --- homeSensitiveData
val homeShownDataFl = homeDataFl
val homeShownDataShow = homeDataShow
val homeShownDataLabels = homeDataLabels
con awayShownData = awayData
fun awayShownData r = r --- awaySensitiveData
val awayShownDataFl = awayDataFl
val awayShownDataShow = awayDataShow
val awayShownDataLabels = awayDataLabels
val my_listeners = listeners
val amHome = amHome
end)
structure HomePrivileged = HomeFn(struct
con homeShownData = homeData ++ homeSensitiveData
fun homeShownData r = r
val homeShownDataFl = @Folder.concat ! homeDataFl homeSensitiveDataFl
val homeShownDataShow = homeDataShow ++ homeSensitiveDataShow
val homeShownDataLabels = homeDataLabels ++ homeSensitiveDataLabels
con awayShownData = awayData ++ awaySensitiveData
fun awayShownData r = r
val awayShownDataFl = @Folder.concat ! awayDataFl awaySensitiveDataFl
val awayShownDataShow = awayDataShow ++ awaySensitiveDataShow
val awayShownDataLabels = awayDataLabels ++ awaySensitiveDataLabels
val my_listeners = privilegedListeners
val amHome = amPrivilegedHome
end)
structure Away = struct
type event = {Event : $eventKey, Data : $eventData, Registered : source bool}
type events = list event
type input = _
type a = _
fun ensure aw =
user <- amAway;
case user of
None => error <xml>Must be authenticated to access this page</xml>
| Some user =>
if user = aw then
return ()
else
error <xml>Wrong user to be accessing this page</xml>
fun add ev aw =
ensure aw;
da <- oneRow1 (SELECT away.{{awayData}}, away.{{awaySensitiveData}}
FROM away
WHERE {@@Sql.easy_where [#Away] [awayKey] [_] [_] [_] [_]
! ! awayInj' awayKeyFl aw});
@@Sql.easy_insert [eventKey ++ awayKey] [_] (eventInj' ++ awayInj')
(@Folder.concat ! eventKeyFl awayKeyFl) awayRsvp (ev ++ aw);
queryI1 (SELECT * FROM listeners)
(fn r => send r.Channel {Event = ev,
User = Away (aw, Some (da --- awaySensitiveData)),
Operation = Add});
queryI1 (SELECT * FROM privilegedListeners)
(fn r => send r.Channel {Event = ev,
User = Away (aw, Some da),
Operation = Add})
fun del ev aw =
ensure aw;
dml (DELETE FROM awayRsvp
WHERE {@@Sql.easy_where [#T] [eventKey ++ awayKey] [_] [_] [_] [_]
! ! (eventInj' ++ awayInj') (@Folder.concat ! eventKeyFl awayKeyFl) (ev ++ aw)});
queryI1 (SELECT * FROM listeners)
(fn r => send r.Channel {Event = ev,
User = Away (aw, None),
Operation = Del});
queryI1 (SELECT * FROM privilegedListeners)
(fn r => send r.Channel {Event = ev,
User = Away (aw, None),
Operation = Del})
fun create aw =
events <- List.mapQueryM (SELECT event.{{eventKey}}, event.{{eventData}},
NOT ((SELECT TRUE
FROM awayRsvp
WHERE {@@Sql.easy_where [#AwayRsvp] [awayKey] [_] [_] [_] [_]
! ! awayInj' awayKeyFl aw}
AND {@@Sql.easy_join [#Event] [#AwayRsvp] [eventKey]
[eventData ++ eventRest] [awayKey] [_] [_] [_]
! ! ! ! eventKeyFl}) IS NULL) AS Regd
FROM event
ORDER BY {{{@Sql.order_by eventKeyFl
(@Sql.some_fields [#Event] [eventKey] ! ! eventKeyFl)
sql_asc}}})
(fn r =>
regd <- source r.Regd;
return {Event = r.Event --- eventData,
Data = r.Event --- eventKey,
Registered = regd});
return {Self = aw, Events = events}
fun render t =
List.mapX (fn ev => <xml>
<active code={expanded <- source False;
return <xml><div>
<h2>
<button dynClass={exp <- signal expanded;
return (if exp then
CLASS "btn btn-xs glyphicon glyphicon-chevron-up"
else
CLASS "btn btn-xs glyphicon glyphicon-chevron-down")}
onclick={fn _ =>
exp <- get expanded;
set expanded (not exp)}/>
{[@show eventKeyShow ev.Event]}
</h2>
<dyn signal={exp <- signal expanded;
if not exp then
return <xml/>
else
regd <- signal ev.Registered;
return <xml>
<div>{M.render ev.Data}</div>
{if regd then
<xml>
<span class="glyphicon glyphicon-ok"/>
<span>Attending</span>
<button class="btn btn-primary"
value="Un-RSVP"
onclick={fn _ =>
rpc (del ev.Event t.Self);
set ev.Registered False}/>
</xml>
else
<xml>
<span>Not attending</span>
<button class="btn btn-primary"
value="RSVP"
onclick={fn _ =>
rpc (add ev.Event t.Self);
set ev.Registered True}/>
</xml>}
</xml>}/>
</div></xml>}/>
</xml>) t.Events
fun ui x = {
Create = create x,
Onload = fn _ => return (),
Render = fn _ => render
}
end
end