changeset 1:4d8165e8f89a

Some help with building forms
author Adam Chlipala <adam@chlipala.net>
date Thu, 06 Jan 2011 16:45:47 -0500
parents 37eefd0a2ed4
children 33c83ae7c9af
files forms.ur forms.urs lib.urp select.ur select.urs
diffstat 5 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/forms.ur	Thu Jan 06 16:45:47 2011 -0500
@@ -0,0 +1,8 @@
+datatype readiness a = Ready of a | Waiting | Invalid of string
+datatype rpcResult a = Success of a | Failure of string
+
+fun warning [a] (s : signal (readiness a)) =
+    <xml><dyn signal={v <- s;
+                      return (case v of
+                                  Invalid s => <xml><b>{[s]}</b></xml>
+                                | _ => <xml/>)}/></xml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/forms.urs	Thu Jan 06 16:45:47 2011 -0500
@@ -0,0 +1,4 @@
+datatype readiness a = Ready of a | Waiting | Invalid of string
+datatype rpcResult a = Success of a | Failure of string
+
+val warning : a ::: Type -> signal (readiness a) -> xbody
--- a/lib.urp	Tue Dec 14 10:55:22 2010 -0500
+++ b/lib.urp	Thu Jan 06 16:45:47 2011 -0500
@@ -1,2 +1,5 @@
+$/list
 timer
 waitbox
+select
+forms
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/select.ur	Thu Jan 06 16:45:47 2011 -0500
@@ -0,0 +1,9 @@
+fun crender r =
+    <xml><cselect source={r.Selected}>
+      {List.mapX (fn r' => <xml><coption value={r'.Key}>{[r'.Display]}</coption></xml>) r.Choices}
+    </cselect></xml>
+
+fun crender' r =
+    <xml><cselect source={r.Selected}>
+      {List.mapX (fn s => <xml><coption>{[s]}</coption></xml>) r.Choices}
+    </cselect></xml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/select.urs	Thu Jan 06 16:45:47 2011 -0500
@@ -0,0 +1,7 @@
+val crender : {Choices : list {Key : string, Display : string},
+               Selected : source string}
+              -> xbody
+
+val crender' : {Choices : list string,
+                Selected : source string}
+               -> xbody