diff options
Diffstat (limited to 'demo/more/checkGroup.ur')
-rw-r--r-- | demo/more/checkGroup.ur | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/demo/more/checkGroup.ur b/demo/more/checkGroup.ur new file mode 100644 index 00000000..ab1cc781 --- /dev/null +++ b/demo/more/checkGroup.ur @@ -0,0 +1,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 |