Some example files mentioned in the howto.
This commit is contained in:
parent
07ef3aa5c2
commit
52e0a557e2
|
@ -0,0 +1,29 @@
|
|||
(define-structure surflet surflet-interface
|
||||
(open surflets
|
||||
scheme-with-scsh)
|
||||
(begin
|
||||
(define (main req)
|
||||
(let* ((select-input-field
|
||||
(make-select
|
||||
(map make-annotated-select-option
|
||||
'("Icecream" "Chocolate" "Candy")
|
||||
'(1.5 2.0 0.5))))
|
||||
(req (send-html/suspend
|
||||
(lambda (k-url)
|
||||
`(html
|
||||
(head (title "Sweet Store"))
|
||||
(body
|
||||
(h1 "Your choice")
|
||||
(surflet-form
|
||||
,k-url
|
||||
(p "Select the sweet you want:"
|
||||
,select-input-field)
|
||||
,(make-submit-button)))))))
|
||||
(bindings (get-bindings req))
|
||||
(cost (input-field-value select-input-field bindings)))
|
||||
(send-html/finish
|
||||
`(html (head (title "Receipt"))
|
||||
(body
|
||||
(h2 "Your receipt:")
|
||||
(p "This costs you $" ,cost "."))))))
|
||||
))
|
|
@ -0,0 +1,12 @@
|
|||
(define-structure surflet surflet-interface
|
||||
(open surflets
|
||||
scheme-with-scsh)
|
||||
(begin
|
||||
|
||||
(define (main req)
|
||||
(send-html/finish
|
||||
`(html (body (h1 "Hello, world!")
|
||||
(p "The current date and time is "
|
||||
,(format-date "~H:~M:~S ~p ~m/~d/~Y" (date)))))))
|
||||
))
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
(define-structure surflet surflet-interface
|
||||
(open surflets
|
||||
scheme-with-scsh)
|
||||
(begin
|
||||
|
||||
(define (main req)
|
||||
(send-html/suspend
|
||||
(lambda (k-url)
|
||||
`(html (body (h1 "Hello, world!")
|
||||
(p (a (@ (href ,k-url)) "Next page -->"))))))
|
||||
|
||||
(send-html/finish
|
||||
'(html (body (h1 "Hello, again!")))))
|
||||
))
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
(define-structure surflet surflet-interface
|
||||
(open surflets
|
||||
scheme-with-scsh)
|
||||
(begin
|
||||
|
||||
(define (main req)
|
||||
(send-html/finish
|
||||
'(html (body (h1 "Hello, world!")))))
|
||||
))
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
(define-structure surflet surflet-interface
|
||||
(open surflets
|
||||
scheme-with-scsh)
|
||||
(begin
|
||||
(define (main req)
|
||||
(let* ((text-input (make-text-field))
|
||||
(submit-button (make-submit-button))
|
||||
(req (send-html/suspend
|
||||
(lambda (k-url)
|
||||
`(html
|
||||
(body
|
||||
(h1 "Echo")
|
||||
(surflet-form ,k-url
|
||||
(p "Please enter something:"
|
||||
,text-input
|
||||
,submit-button)))))))
|
||||
(bindings (get-bindings req))
|
||||
(user-input (input-field-value text-input bindings)))
|
||||
(send-html/finish
|
||||
`(html (body
|
||||
(h1 "Echo result")
|
||||
(p "You've entered: '" ,user-input "'."))))))
|
||||
))
|
Loading…
Reference in New Issue