annotate tests/crud1.ur @ 355:fa2d25fe75ce
top.urs indents and type-checks with new twiddle syntax
author |
Adam Chlipala <adamc@hcoop.net> |
date |
Sun, 12 Oct 2008 11:50:21 -0400 |
parents |
9390c55b9f1f |
children |
c1e96b387115 |
rev |
line source |
adamc@325
|
1 table t1 : {Id : int, A : int, B : string, C : float, D : bool}
|
adamc@325
|
2
|
adamc@353
|
3 val a = {Nam = "A",
|
adamc@353
|
4 Show = txt _,
|
adamc@353
|
5 Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
|
adamc@353
|
6 WidgetPopulated = fn (nm :: Name) n =>
|
adamc@353
|
7 <lform><textbox{nm} value={show _ n}/></lform>,
|
adamc@353
|
8 Parse = readError _,
|
adamc@353
|
9 Inject = _}
|
adamc@353
|
10
|
adamc@353
|
11 val b = {Nam = "B",
|
adamc@353
|
12 Show = txt _,
|
adamc@353
|
13 Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
|
adamc@353
|
14 WidgetPopulated = fn (nm :: Name) s =>
|
adamc@353
|
15 <lform><textbox{nm} value={s}/></lform>,
|
adamc@353
|
16 Parse = readError _,
|
adamc@353
|
17 Inject = _}
|
adamc@353
|
18
|
adamc@353
|
19 val c = {Nam = "C",
|
adamc@353
|
20 Show = txt _,
|
adamc@353
|
21 Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
|
adamc@353
|
22 WidgetPopulated = fn (nm :: Name) n =>
|
adamc@353
|
23 <lform><textbox{nm} value={show _ n}/></lform>,
|
adamc@353
|
24 Parse = readError _,
|
adamc@353
|
25 Inject = _}
|
adamc@353
|
26
|
adamc@353
|
27 val d = {Nam = "D",
|
adamc@353
|
28 Show = txt _,
|
adamc@353
|
29 Widget = fn nm :: Name => <lform><checkbox{nm}/></lform>,
|
adamc@353
|
30 WidgetPopulated = fn (nm :: Name) b =>
|
adamc@353
|
31 <lform><checkbox{nm} checked={b}/></lform>,
|
adamc@353
|
32 Parse = fn x => x,
|
adamc@353
|
33 Inject = _}
|
adamc@353
|
34
|
adamc@325
|
35 open Crud.Make(struct
|
adamc@350
|
36 val tab = t1
|
adamc@350
|
37
|
adamc@350
|
38 val title = "Crud1"
|
adamc@350
|
39
|
adamc@353
|
40 val cols = {A = a,
|
adamc@353
|
41 B = b,
|
adamc@353
|
42 C = c,
|
adamc@353
|
43 D = d}
|
adamc@350
|
44 end)
|