diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-10-23 18:45:10 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-10-23 18:45:10 -0400 |
commit | 9569ae99c75cb74aeeb6fa02e6eec9eff2c7669f (patch) | |
tree | 6d1b3b0450e7d90ffb86bc43ce2c479ba9b7c78f /demo/crud2.ur | |
parent | fbde7928c43149e02806949343783dc6e885ab0f (diff) |
Crud2 demo
Diffstat (limited to 'demo/crud2.ur')
-rw-r--r-- | demo/crud2.ur | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/demo/crud2.ur b/demo/crud2.ur new file mode 100644 index 00000000..1db376d4 --- /dev/null +++ b/demo/crud2.ur @@ -0,0 +1,34 @@ +table t : {Id : int, Nam : string, Ready : bool} + +open Crud.Make(struct + val tab = t + + val title = "Are you ready?" + + val cols = {Nam = Crud.string "Name", + Ready = {Nam = "Ready", + Show = (fn b => if b then + <xml>Ready!</xml> + else + <xml>Not ready</xml>), + Widget = (fn (nm :: Name) => <xml> + <select{nm}> + <option>Ready</option> + <option>Not ready</option> + </select> + </xml>), + WidgetPopulated = (fn (nm :: Name) b => <xml> + <select{nm}> + <option selected={b}>Ready</option> + <option selected={not b}>Not ready</option> + </select> + </xml>), + Parse = (fn s => + case s of + "Ready" => True + | "Not ready" => False + | _ => error <xml>Invalid ready/not ready</xml>), + Inject = _ + } + } + end) |