Mercurial > urweb
comparison tests/crud.ur @ 336:34847732cefc
Crud gets column headings
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 13 Sep 2008 20:04:28 -0400 |
parents | 9601c717d2f3 |
children | 18d5affa790d |
comparison
equal
deleted
inserted
replaced
335:bc5015b89dd2 | 336:34847732cefc |
---|---|
1 con colMeta' = fn t :: Type => {Show : t -> xbody} | 1 con colMeta' = fn t :: Type => {Nam : string, Show : t -> xbody} |
2 con colMeta = fn cols :: {Type} => $(Top.mapTT colMeta' cols) | 2 con colMeta = fn cols :: {Type} => $(Top.mapTT colMeta' cols) |
3 | 3 |
4 functor Make(M : sig | 4 functor Make(M : sig |
5 con cols :: {Type} | 5 con cols :: {Type} |
6 constraint [Id] ~ cols | 6 constraint [Id] ~ cols |
20 <tr> | 20 <tr> |
21 <td>{txt _ fs.T.Id}</td> | 21 <td>{txt _ fs.T.Id}</td> |
22 {foldTRX2 [idT] [colMeta'] [tr] | 22 {foldTRX2 [idT] [colMeta'] [tr] |
23 (fn (nm :: Name) (t :: Type) (rest :: {Type}) => | 23 (fn (nm :: Name) (t :: Type) (rest :: {Type}) => |
24 [[nm] ~ rest] => | 24 [[nm] ~ rest] => |
25 fn v funcs => <tr> | 25 fn v col => <tr> |
26 <td>{funcs.Show v}</td> | 26 <td>{col.Show v}</td> |
27 </tr>) | 27 </tr>) |
28 [M.cols] (fs.T -- #Id) M.cols} | 28 [M.cols] (fs.T -- #Id) M.cols} |
29 </tr> | 29 </tr> |
30 </body>); | 30 </body>); |
31 return <html><head> | 31 return <html><head> |
34 </head><body> | 34 </head><body> |
35 | 35 |
36 <h1>{cdata M.title}</h1> | 36 <h1>{cdata M.title}</h1> |
37 | 37 |
38 <table border={1}> | 38 <table border={1}> |
39 <tr> <th>ID</th> </tr> | 39 <tr> |
40 <th>ID</th> | |
41 {foldTRX [colMeta'] [tr] | |
42 (fn (nm :: Name) (t :: Type) (rest :: {Type}) => | |
43 [[nm] ~ rest] => | |
44 fn col => <tr> | |
45 <th>{cdata col.Nam}</th> | |
46 </tr>) | |
47 [M.cols] M.cols} | |
48 </tr> | |
40 {rows} | 49 {rows} |
41 </table> | 50 </table> |
42 </body></html> | 51 </body></html> |
43 | 52 |
44 end | 53 end |