summaryrefslogtreecommitdiff
path: root/demo/more/checkGroup.ur
blob: ab1cc78165c4ebd415871a16d7c8e7e3ee823af8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
con t ctx data = list (data * xml ctx [] [] * source bool)

fun create [ctx] [data] (items : list (data * xml ctx [] [] * bool)) =
    List.mapM (fn (d, x, b) => s <- source b; return (d, x, s)) items

fun render [ctx] [data] [[Body] ~ ctx] (t : t ([Body] ++ ctx) data) =
    List.mapX (fn (_, x, s) => <xml><ccheckbox source={s}/> {x}<br/></xml>) t

fun selected [ctx] [data] (t : t ctx data) =
    List.foldlM (fn (d, _, s) ls =>
                    s <- signal s;
                    return (if s then
                                d :: ls
                            else
                                ls)) [] t