changeset 20:2342d9baa0df

New OpenidUser.Make parameter: ready
author Adam Chlipala <adam@chlipala.net>
date Thu, 06 Jan 2011 16:46:09 -0500
parents 5e03668972ea
children 354dae3008de
files src/ur/openidUser.ur src/ur/openidUser.urs
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ur/openidUser.ur	Thu Jan 06 15:25:11 2011 -0500
+++ b/src/ur/openidUser.ur	Thu Jan 06 16:46:09 2011 -0500
@@ -8,6 +8,7 @@
                  type creationData
                  val creationState : transaction creationState
                  val render : creationState -> xtable
+                 val ready : creationState -> signal bool
                  val tabulate : creationState -> signal creationData
                  val choose : sql_table ([Id = string] ++ cols) [Pkey = [Id]] -> creationData -> transaction $cols
 
@@ -117,12 +118,17 @@
                       <table class={M.formClass}>
                         <tr> <th class={M.formClass}>Username:</th> <td><ctextbox source={uid}/></td> </tr>
                         {M.render cs}
-                        <tr> <td><button value="Create Account" onclick={uid <- get uid;
-                                                                         data <- Basis.current (M.tabulate cs);
-                                                                         res <- rpc (finishSignup uid data);
-                                                                         case res of
-                                                                             None => redirect (bless after)
-                                                                           | Some msg => alert msg}/></td> </tr>
+                        <tr> <td><dyn signal={b <- M.ready cs;
+                                              return (if b then
+                                                          <xml><button value="Create Account"
+                                                                       onclick={uid <- get uid;
+                                                                                data <- Basis.current (M.tabulate cs);
+                                                                                res <- rpc (finishSignup uid data);
+                                                                                case res of
+                                                                                    None => redirect (bless after)
+                                                                                  | Some msg => alert msg}/></xml>
+                                                      else
+                                                          <xml/>)}/></td> </tr>
                       </table>
                     </xml>
                 end
--- a/src/ur/openidUser.urs	Thu Jan 06 15:25:11 2011 -0500
+++ b/src/ur/openidUser.urs	Thu Jan 06 16:46:09 2011 -0500
@@ -28,6 +28,9 @@
                  val render : creationState -> xtable
                  (* Display widgets. *)
 
+                 val ready : creationState -> signal bool
+                 (* Is the data ready to send? *)
+
                  val tabulate : creationState -> signal creationData
                  (* Functionalize current state. *)