Mercurial > urweb
comparison demo/more/expandable.ur @ 1025:7facf72aaf0a
Initial form for paper assignment
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 01 Nov 2009 14:26:20 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1024:93415bcf54c0 | 1025:7facf72aaf0a |
---|---|
1 con t ctx = source bool * xml ctx [] [] | |
2 | |
3 fun create [ctx] (x : xml ctx [] []) = | |
4 s <- source False; | |
5 return (s, x) | |
6 | |
7 fun expand [ctx] (t : t ctx) = | |
8 set t.1 True | |
9 | |
10 fun collapse [ctx] (t : t ctx) = | |
11 set t.1 False | |
12 | |
13 fun render [ctx] [[Body] ~ ctx] (t : t ([Body] ++ ctx)) = | |
14 <xml><dyn signal={b <- signal t.1; | |
15 return (if b then | |
16 <xml> | |
17 <button value="-" onclick={collapse t}/><br/> | |
18 {t.2} | |
19 </xml> | |
20 else | |
21 <xml> | |
22 <button value="+" onclick={expand t}/><br/> | |
23 </xml>)}/></xml> |