blob: 1db376d4c35ad94c1754d4b218810ed36a2ef0ef (
plain)
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
|
table t : {Id : int, Nam : string, Ready : bool}
open Crud.Make(struct
val tab = t
val title = "Are you ready?"
val cols = {Nam = Crud.string "Name",
Ready = {Nam = "Ready",
Show = (fn b => if b then
<xml>Ready!</xml>
else
<xml>Not ready</xml>),
Widget = (fn (nm :: Name) => <xml>
<select{nm}>
<option>Ready</option>
<option>Not ready</option>
</select>
</xml>),
WidgetPopulated = (fn (nm :: Name) b => <xml>
<select{nm}>
<option selected={b}>Ready</option>
<option selected={not b}>Not ready</option>
</select>
</xml>),
Parse = (fn s =>
case s of
"Ready" => True
| "Not ready" => False
| _ => error <xml>Invalid ready/not ready</xml>),
Inject = _
}
}
end)
|