Commit 6111c2ca authored by amirouche's avatar amirouche

prototype styles in scheme

parent 68084677
......@@ -162,6 +162,23 @@ exec guile -L $(pwd) -e '(@ (web) main)' -s "$0" "$@"
`(p (@ (class "error")) ,error)
'()))
(define (make-value value)
(match value
((? string? string) string)
((? symbol? symbol) (symbol->string symbol))))
(define (make-style alist)
(let loop ((alist alist)
(out ""))
(if (null? alist)
(string-append out ";")
(loop (cdr alist)
(string-append out
"; "
(symbol->string (caar alist))
": "
(make-value (cdar alist)))))))
(define (make-class alist)
"Create html class attribute with an ALIST"
(let loop ((alist alist)
......@@ -176,8 +193,9 @@ exec guile -L $(pwd) -e '(@ (web) main)' -s "$0" "$@"
(let ((login-error (assoc-ref errors "login"))
(password-error (assoc-ref errors "password"))
(confirmation-error (assoc-ref errors "confirmation")))
(template "login"
`(form (@ (method "POST"))
(template "signup"
`(form (@ (method "POST")
(style ,(make-style `((border . "1px solid black")))))
(h2 "Sign up")
(div (@ (class ,(make-class `(("form-item" . #t)
("error" . ,login-error)))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment