-
Notifications
You must be signed in to change notification settings - Fork 16
/
paramQuery1.ur
50 lines (40 loc) · 1.29 KB
/
paramQuery1.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
open Bootstrap
functor Make(M : sig
type input
con fs :: {Type}
con tab :: Name
val query : input -> sql_query [] [] [tab = fs] []
val fl : folder fs
val show : $(map show fs)
val labels : $(map (fn _ => string) fs)
end) = struct
open M
type a = list $fs
fun create inp = queryL1 (query inp)
fun onload _ = return ()
fun render _ a = <xml>
<table class="bs-table">
<thead><tr>
{@mapX [fn _ => string] [tr]
(fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] lab => <xml><th>{[lab]}</th></xml>)
fl labels}
</tr></thead>
<tbody>
{List.mapX (fn fs => <xml>
<tr>
{@mapX2 [show] [ident] [tr]
(fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] (_ : show t) (v : t) => <xml><td>{[v]}</td></xml>)
fl show fs}
</tr>
</xml>) a}
</tbody>
</table>
</xml>
fun notification _ _ = <xml></xml>
fun buttons _ _ = <xml></xml>
fun ui inp = {Create = create inp,
Onload = onload,
Render = render,
Notification = notification,
Buttons = buttons}
end