Mercurial > urweb
annotate tests/styleRt.ur @ 1886:b7cd3c7c7edd
Interpret 'table' signature items more flexibly, automatically adding (Ur) constraints to support a kind of subtyping over (SQL) constraint sets
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Mon, 04 Nov 2013 15:14:23 -0500 |
parents | e9587120831a |
children |
rev | line source |
---|---|
adam@1755 | 1 fun handler r = |
adam@1755 | 2 return <xml><body> |
adam@1755 | 3 <span style={oneProperty |
adam@1755 | 4 (oneProperty noStyle (value (property r.Prop) (atom r.Valu))) |
adam@1755 | 5 (value (property "background") (css_url (bless r.Url)))}> |
adam@1755 | 6 Teeeest |
adam@1755 | 7 </span> |
adam@1755 | 8 </body></xml> |
adam@1755 | 9 |
adam@1755 | 10 fun main () = |
adam@1755 | 11 prop <- source ""; |
adam@1755 | 12 valu <- source ""; |
adam@1755 | 13 url <- source ""; |
adam@1755 | 14 xm <- source <xml/>; |
adam@1755 | 15 return <xml><body> |
adam@1755 | 16 Property: <ctextbox source={prop}/><br/> |
adam@1755 | 17 Value: <ctextbox source={valu}/><br/> |
adam@1755 | 18 URL: <ctextbox source={url}/><br/> |
adam@1755 | 19 <button value="Go!" onclick={prop <- get prop; |
adam@1755 | 20 valu <- get valu; |
adam@1755 | 21 url <- get url; |
adam@1755 | 22 set xm <xml><span style={oneProperty |
adam@1755 | 23 (oneProperty noStyle (value (property prop) (atom valu))) |
adam@1755 | 24 (value (property "background") (css_url (bless url)))}> |
adam@1755 | 25 Teeeest |
adam@1755 | 26 </span></xml>}/> |
adam@1755 | 27 <hr/> |
adam@1755 | 28 <dyn signal={signal xm}/> |
adam@1755 | 29 <hr/> |
adam@1755 | 30 <h2>Or the old fashioned way...</h2> |
adam@1755 | 31 |
adam@1755 | 32 <form> |
adam@1755 | 33 Property: <textbox{#Prop}/><br/> |
adam@1755 | 34 Value: <textbox{#Valu}/><br/> |
adam@1755 | 35 URL: <textbox{#Url}/><br/> |
adam@1755 | 36 <submit action={handler}/> |
adam@1755 | 37 </form> |
adam@1755 | 38 </body></xml> |